Skip to content

Commit ae3943a

Browse files
committed
ci: add pre-commit autoupdate
1 parent 5433e08 commit ae3943a

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Update .pre-commit-config.yaml
2+
3+
on:
4+
schedule:
5+
- cron: '0 3 * * 1' # Every Monday at 03:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-pre-commit-config:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
17+
with:
18+
python-version: '3.13'
19+
20+
- name: Install Hatch
21+
run: pip install --upgrade hatch
22+
23+
- name: Set up Git user
24+
run: |
25+
git config --global user.name "github-actions[bot]"
26+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
27+
28+
- name: Update .pre-commit-config.yaml
29+
run: hatch run pre-commit autoupdate --freeze
30+
31+
- name: Check for changes
32+
id: changes
33+
run: |
34+
git add .pre-commit-config.yaml
35+
if git diff --cached --quiet; then
36+
echo "changed=false" >> $GITHUB_OUTPUT
37+
else
38+
echo "changed=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Create Pull Request
42+
if: steps.changes.outputs.changed == 'true'
43+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7
44+
with:
45+
commit-message: "chore(deps): Update .pre-commit-config.yaml"
46+
title: "chore(deps): Update .pre-commit-config.yaml"
47+
body: "Automated update of .pre-commit-config.yaml via scheduled workflow."
48+
branch: "update/pre-commit-config-yaml"
49+
base: ${{ github.ref_name }}
50+
labels: "update"
51+
reviewers: "linuxdaemon"

0 commit comments

Comments
 (0)