5
0
Fork 0
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:
Yu Ishikawa 2025-10-09 12:01:53 +09:00 committed by GitHub
parent 1b06ec171f
commit 83edd4dade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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') }}