Skip to content

Commit 2afd48d

Browse files
shaanmajidj178
andauthored
Support prek.toml and .pre-commit-config.yml in cache key (#65)
Expand hashFiles() to cover all three config filenames that prek recognizes (prek.toml, .pre-commit-config.yaml, .pre-commit-config.yml). Update README requirements to reflect the supported config files. Closes #64 --------- Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
1 parent ce72219 commit 2afd48d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Running `prek` in a separate step can be useful for example when you need to cus
9595

9696
## Requirements
9797

98-
Your repository must have a `.pre-commit-config.yaml` file configured for use with pre-commit hooks.
98+
Your repository must have a [prek configuration](https://prek.j178.dev/configuration/) file (`prek.toml`, `.pre-commit-config.yaml`, or `.pre-commit-config.yml`).
9999

100100
## License
101101

action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ runs:
118118
# `env.pythonLocation` is set by `actions/setup-python`, pointing to the directory where Python is installed.
119119
# prek doesn't require Python, but the hooks it runs often do (e.g., pre-commit hooks), changing the Python version makes Python virtual environments invalid.
120120
# So we include it in the cache key to avoid using invalid caches.
121-
key: prek-v1|${{ runner.os }}|${{ runner.arch }}|${{ env.pythonLocation }}|${{ hashFiles(format('{0}/**/.pre-commit-config.yaml', inputs.working-directory)) }}
121+
key: prek-v1|${{ runner.os }}|${{ runner.arch }}|${{ env.pythonLocation }}|${{ hashFiles(format('{0}/**/prek.toml', inputs.working-directory), format('{0}/**/.pre-commit-config.yaml', inputs.working-directory), format('{0}/**/.pre-commit-config.yml', inputs.working-directory)) }}
122122

123123
- name: Run prek
124124
if: inputs.install-only == 'false'

0 commit comments

Comments
 (0)