Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pre-commit-uv #1

Merged
merged 2 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: actions/checkout@v4
- name: self test action
uses: ./
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ ___
pre-commit/action
=================

a GitHub action to run [pre-commit](https://pre-commit.com)
A GitHub action to run [pre-commit](https://pre-commit.com)
using [pre-commit-uv](https://github.com/tox-dev/pre-commit-uv).

### using this action

Expand All @@ -31,15 +32,14 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
- uses: actions/checkout@v4
- uses: tox-dev/action-pre-commit-uv@v1
```

This does a few things:

- clones the code
- installs python
- installs uv
- sets up the `pre-commit` cache

### using this action with custom invocations
Expand All @@ -51,7 +51,7 @@ Here's a sample step configuration that only runs the `flake8` hook against all
the files (use the template above except for the `pre-commit` action):

```yaml
- uses: pre-commit/action@v3.0.1
- uses: tox-dev/action-pre-commit-uv@v1
with:
extra_args: flake8 --all-files
```
Expand Down
7 changes: 2 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,10 @@ inputs:
runs:
using: composite
steps:
- run: python -m pip install pre-commit
shell: bash
- run: python -m pip freeze --local
shell: bash
- uses: hynek/setup-cached-uv@v2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
- run: uv run --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash