5
0
Fork 0
mirror of https://github.com/pre-commit/action.git synced 2025-11-11 04:26:56 +00:00
pre-commit-action/action.yml
Carl Thomé 0e2472f03e
Always save checked out hooks in GitHub Actions cache
As of actions/cache@v4 it's now possible to always save the cache, even if a previous step fails. This would be useful for avoiding recloning hooks when `pre-commit run` fails and the cache is empty.
2024-02-20 00:56:11 +01:00

21 lines
601 B
YAML

name: pre-commit
description: run pre-commit
inputs:
extra_args:
description: options to pass to pre-commit run
required: false
default: '--all-files'
runs:
using: composite
steps:
- run: python -m pip install pre-commit
shell: bash
- run: python -m pip freeze --local
shell: bash
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
save-always: true
- run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash