-
Notifications
You must be signed in to change notification settings - Fork 20
54 lines (45 loc) · 1.44 KB
/
pre-commit.yml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: pre-commit
on:
push:
branches-ignore:
- 'master'
concurrency:
group: pre-commit-${{ github.ref }}-1
# main should run through entire queue of commits for debugging
cancel-in-progress: ${{ github.ref_name != 'main'}}
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: "3.11"
architecture: "x64"
- uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}-
- name: Install system dependencies
run: |
pip install --upgrade pip wheel setuptools
- name: Run pre-commit
uses: pre-commit/action@v2.0.0
continue-on-error: true
- name: Commit files
run: |
if [[ `git status --porcelain --untracked-files=no` ]]; then
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout -- .github/workflows
git commit -m "pre-commit" -a
fi
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Check pre-commit
uses: pre-commit/action@v2.0.0