5
0
Fork 0
mirror of https://github.com/pre-commit/action.git synced 2025-11-07 10:46:56 +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
required: false
default: '--all-files'
enable_cache:
description: Whether to cache pre-commit hooks
required: false
default: 'true'
runs:
using: composite
steps:
@ -13,6 +17,7 @@ runs:
- run: python -m pip freeze --local
shell: bash
- uses: actions/cache@v4
if: inputs.enable_cache == 'true'
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}