Skip to content

Commit a20a96f

Browse files
authored
Update pre-commit.yml (#298)
1 parent 924049f commit a20a96f

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/pre-commit.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
name: pre-commit
22

3+
permissions:
4+
contents: read
5+
36
on: [pull_request]
47

58
jobs:
69
pre-commit:
7-
name: Run pre-commit # https://pre-commit.com/
10+
name: Run pre-commit
811
runs-on: ubuntu-latest
912
steps:
10-
- uses: actions/checkout@v4
11-
- uses: actions/setup-python@v5 # https://www.python.org/
13+
- name: Checkout Code
14+
uses: actions/checkout@v6
15+
with:
16+
# Fetch all history so pre-commit can compare if needed
17+
fetch-depth: 0
18+
- name: Set up Python
19+
uses: actions/setup-python@v6
1220
with:
13-
python-version: "3.x" # Version range or exact version of a Python version to use, using SemVer's version range syntax
21+
python-version: "3.x"
1422
architecture: "x64" # optional x64 or x86. Defaults to x64 if not specified
15-
- name: Install dependencies # https://pip.pypa.io/en/stable/
23+
- name: Install dependencies
1624
run: |
1725
python -m pip install --upgrade pip
1826
pip install pre-commit
1927
- name: Set PY
2028
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
21-
- uses: actions/cache@v3
29+
- name: Cache Pre-commit Hooks
30+
uses: actions/cache@v4
2231
with:
2332
path: ~/.cache/pre-commit
2433
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
25-
- name: Run pre-commit
26-
run: pre-commit run --all-files
34+
- name: Run pre-commit hooks
35+
run: pre-commit run --all-files --show-diff-on-failure --color always

0 commit comments

Comments
 (0)