mirror of
https://github.com/pre-commit/action.git
synced 2025-11-07 18:56:55 +00:00
Update action.yml
## Motivation In my experience, the cache of pre-commits can be quite large. It takes a couple of minutes to fetch the cache in GitHub Actions. I assume it might be faster to install hooks than to fetch cache. So, it would be useful to add an input `enable_cache` if we cache pre-commit hooks or not.
This commit is contained in:
parent
1b06ec171f
commit
83edd4dade
1 changed files with 5 additions and 0 deletions
|
|
@ -5,6 +5,10 @@ inputs:
|
||||||
description: options to pass to pre-commit run
|
description: options to pass to pre-commit run
|
||||||
required: false
|
required: false
|
||||||
default: '--all-files'
|
default: '--all-files'
|
||||||
|
enable_cache:
|
||||||
|
description: Whether to cache pre-commit hooks
|
||||||
|
required: false
|
||||||
|
default: 'true'
|
||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
|
|
@ -13,6 +17,7 @@ runs:
|
||||||
- run: python -m pip freeze --local
|
- run: python -m pip freeze --local
|
||||||
shell: bash
|
shell: bash
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
|
if: inputs.enable_cache == 'true'
|
||||||
with:
|
with:
|
||||||
path: ~/.cache/pre-commit
|
path: ~/.cache/pre-commit
|
||||||
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue