5
0
Fork 0
mirror of https://github.com/pre-commit/action.git synced 2025-11-07 10:46:56 +00:00

add cache restore key and run gc in post step

This will allow us to restore all available cached hooks to reduce the
time spent "Initializing environment" on each run.

If any of the hooks are updated, the `pre-commit gc` command will remove
the now-unused hooks from ~/.cache/pre-commit, ensuring that we don't
store them in the cache indefinitely.
This commit is contained in:
Tom Whitwell 2025-02-14 09:46:20 +00:00
parent 576ff52938
commit 9a134f4f53
No known key found for this signature in database

View file

@ -16,5 +16,10 @@ runs:
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-3|${{ env.pythonLocation }}|
pre-commit-3|
- run: pre-commit run --show-diff-on-failure --color=always ${{ inputs.extra_args }}
shell: bash
- run: pre-commit gc
shell: bash