-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (35 loc) · 1.01 KB
/
update-pre-commit-hooks.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
name: Update Pre-commit Hooks Versions
on:
schedule:
- cron: "51 5 * * 1" # Every Monday morning
workflow_dispatch: # Manual trigger
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Python set up
uses: actions/setup-python@v5
with:
python-version: "3.12"
# pre-commit has its own cache
# cache: "pip"
- name: Install pre-commit
run: |
pip install pre-commit
- name: Run pre-commit autoupdate
run: |
pre-commit autoupdate
- name: Run pre-commit hooks
uses: pre-commit/[email protected]
- name: Commit changes if any
run: |
if [[ $(git status --porcelain) ]]; then
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
git commit -am "Update .pre-commit-config.yaml"
git push
fi