diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 116a2d7..2a4175a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: ./ diff --git a/README.md b/README.md index 2a30ad0..c08a871 100644 --- a/README.md +++ b/README.md @@ -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 @@ -31,15 +32,14 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: pre-commit/action@v3.0.1 + - 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 @@ -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 ``` diff --git a/action.yml b/action.yml index 18ded0d..e0de521 100644 --- a/action.yml +++ b/action.yml @@ -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