Skip to content

Commit

Permalink
Use pre-commit-uv (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Oct 23, 2024
1 parent 576ff52 commit a071220
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
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
- 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

0 comments on commit a071220

Please sign in to comment.