Skip to content

Commit 253f168

Browse files
committed
add pre-commit workflow and auto-update workflow
1 parent 60f34a1 commit 253f168

2 files changed

Lines changed: 80 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Autoupdate pre-commit
2+
3+
on:
4+
workflow_dispatch:
5+
# To guarantee Maintained check is occasionally updated. See
6+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
7+
schedule:
8+
- cron: '28 2 * * 6' # Saturday at 02:28 UTC
9+
10+
permissions: read-all
11+
12+
jobs:
13+
autoupdate:
14+
name: Autoupdate
15+
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 10
18+
19+
permissions:
20+
# Needed to create a PR with autoupdate changes
21+
contents: write
22+
pull-requests: write
23+
24+
steps:
25+
- name: Checkout repo
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
28+
- name: Set up python
29+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v5.6.0
30+
with:
31+
python-version: '3.14'
32+
33+
- name: Install pre-commit
34+
run: pip install pre-commit
35+
36+
- name: Run pre-commit autoupdate
37+
run: pre-commit autoupdate
38+
39+
- name: Create a PR with autoupdate changes
40+
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
41+
with:
42+
commit-message: 'chore: update pre-commit hooks'
43+
add-paths: .pre-commit-config.yaml
44+
branch: 'bot/pre-commit-autoupdate'
45+
delete-branch: true
46+
title: Weekly pre-commit autoupdate
47+
body: |
48+
This PR updates the `.pre-commit-config.yaml` using `pre-commit autoupdate`.
49+
labels: autoupdate

.github/workflows/pre-commit.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
permissions: read-all
9+
10+
jobs:
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 30
14+
steps:
15+
- name: Checkout repo
16+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
17+
18+
- name: Set up python
19+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
20+
with:
21+
python-version: '3.14'
22+
23+
- name: Set up pip packages
24+
uses: BSFishy/pip-action@8f2d471d809dc20b6ada98c91910b6ae6243f318 # v1
25+
with:
26+
packages: |
27+
codespell
28+
pylint
29+
30+
- name: Run pre-commit checks
31+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1

0 commit comments

Comments
 (0)