Skip to content

Commit 066bbb8

Browse files
authored
Merge pull request #191 from AnguseZhang/dev/zhouh
ci: enhance pre-commit update workflow with manual trigger and automa…
2 parents 421155f + 701dc45 commit 066bbb8

1 file changed

Lines changed: 33 additions & 8 deletions

File tree

.github/workflows/update-pre-commit.yml

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,43 @@ name: Update pre-commit hooks
22

33
on:
44
schedule:
5-
- cron: '0 0 * * 0'
6-
workflow_dispatch:
5+
- cron: '0 0 * * 0' # 每周日 UTC 时间 00:00
6+
workflow_dispatch: # 允许手动触发
77

88
jobs:
9-
update:
9+
update-pre-commit:
1010
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
1115
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-python@v5
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
token: ${{ secrets.GITHUB_TOKEN }}
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: '3.11'
25+
26+
- name: Install pre-commit
27+
run: pip install pre-commit
1428

1529
- name: Update pre-commit hooks
16-
uses: creyD/pre-commit-update@v1.2.0
30+
run: pre-commit autoupdate
31+
32+
- name: Create Pull Request if changes
33+
uses: peter-evans/create-pull-request@v5
1734
with:
18-
token: ${{ secrets.GITHUB_TOKEN }}
19-
label: 'dependencies'
35+
commit-message: "chore: update pre-commit hooks"
36+
title: "chore: update pre-commit hooks"
37+
body: |
38+
Automated update of pre-commit hooks via pre-commit autoupdate.
39+
40+
**Changes:**
41+
- Updated hook versions in .pre-commit-config.yaml
42+
branch: "update/pre-commit-hooks"
43+
labels: "dependencies"
44+
delete-branch: true

0 commit comments

Comments
 (0)