Skip to content

Commit 38edcf1

Browse files
committed
ci: add github actions for pre-commit
1 parent e75664b commit 38edcf1

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Pre-commit auto-update
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 1 * *"
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
pre-commit-auto-update:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out repo
17+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
21+
with:
22+
python-version: "3.12"
23+
24+
- name: Install pre-commit
25+
run: pip install pre-commit
26+
27+
- name: Run pre-commit autoupdate
28+
run: pre-commit autoupdate --freeze --jobs "$(nproc)"
29+
30+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
31+
32+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
33+
continue-on-error: true
34+
35+
- name: Create Pull Request
36+
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
37+
with:
38+
token: ${{ secrets.GITHUB_TOKEN }}
39+
branch: bot/pre-commit-autoupdate
40+
delete-branch: true
41+
title: Auto-update pre-commit hooks
42+
commit-message: Auto-update pre-commit hooks
43+
body: |
44+
Update tool versions in pre-commit configs to latest version.
45+
labels: |
46+
automated
47+
dependencies

.github/workflows/pre-commit.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14+
- uses: extractions/setup-just@e33e0265a09d6d736e2ee1e0eb685ef1de4669ff # v3
15+
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
16+
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
17+
if: always()

0 commit comments

Comments
 (0)