-
-
Notifications
You must be signed in to change notification settings - Fork 2
40 lines (33 loc) · 1.16 KB
/
run_precommit.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Run pre-commit
on: [push, pull_request]
jobs:
run_precommit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
# Checkout repository
- uses: actions/checkout@v3
# Setup Python and install pre-commit
- uses: actions/setup-python@v4
with:
python-version: "3.8"
- name: Install pre-commit
run: |
pip install -U pre-commit
# Load cached pre-commit environment
- name: set PY
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }}
# Register problem matchers
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/check-toml.json"
echo "::add-matcher::.github/workflows/matchers/check-yaml.json"
echo "::add-matcher::.github/workflows/matchers/flake8.json"
# Run pre-commit
- name: Run pre-commit
run: |
pre-commit run --show-diff-on-failure --color=never --all-files --verbose