Skip to content
Closed
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
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
This does a few things:

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

### using this action with custom invocations
Expand All @@ -56,6 +56,29 @@ the files (use the template above except for the `pre-commit` action):
extra_args: flake8 --all-files
```

### using a specific version of `uv`

By default, the latest version of `uv` is installed.
If this is not desired, a specific version can be requested using the `uv_version` input:

```yaml
- uses: tox-dev/action-pre-commit-uv@v1
with:
uv_version: "0.8.5"
```

```yaml
- uses: tox-dev/action-pre-commit-uv@v1
with:
uv_version: "0.8.x"
```

```yaml
- uses: tox-dev/action-pre-commit-uv@v1
with:
uv_version: ">=0.8,<9"
```

### using this action in private repositories

prior to v3.0.0, this action had custom behaviour which pushed changes back to
Expand Down
9 changes: 7 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,24 @@ inputs:
description: options to pass to pre-commit run
required: false
default: '--all-files'
uv_version:
description: use a specific version of uv (default latest)
required: false
default: latest
runs:
using: composite
steps:
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6
with:
enable-cache: true
cache-dependency-glob: '.pre-commit-config.yaml'
uv-version: ${{ inputs.uv_version }}
- run: uv run --isolated --no-sync true && echo "pythonLocation=$(uv python find)" >>$GITHUB_ENV
shell: bash
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- run: uv run --no-sync --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
- run: uvx --python '${{ env.pythonLocation }}' --with pre-commit-uv pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash
Loading