File tree Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Expand file tree Collapse file tree 2 files changed +75
-0
lines changed Original file line number Diff line number Diff line change
1
+ name: 'Update Pre-commit Hooks'
2
+ description: 'Updates pre-commit hook versions and creates a PR if changes are detected'
3
+ inputs:
4
+ token:
5
+ description: 'GitHub token for creating PRs'
6
+ required: true
7
+ python-version:
8
+ description: 'Python version to use'
9
+ required: false
10
+ default: '3.13'
11
+
12
+ runs:
13
+ using: composite
14
+ steps:
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ inputs.python-version }}
19
+ - name: Install pre-commit
20
+ shell: bash
21
+ run: pip install pre-commit
22
+ - name: Update pre-commit hooks
23
+ shell: bash
24
+ run: |
25
+ pre-commit autoupdate > /tmp/autoupdate.log 2>&1
26
+ cat /tmp/autoupdate.log
27
+ - name: Check for changes
28
+ id: changes
29
+ shell: bash
30
+ run: |
31
+ if git diff --quiet .pre-commit-config.yaml; then
32
+ echo "changed=false" >> $GITHUB_OUTPUT
33
+ else
34
+ echo "changed=true" >> $GITHUB_OUTPUT
35
+ fi
36
+ - name: Create Pull Request
37
+ if: steps.changes.outputs.changed == 'true'
38
+ uses: peter-evans/create-pull-request@v7
39
+ with:
40
+ token: ${{ inputs.token }}
41
+ commit-message: "[pre-commit] Update hooks versions"
42
+ title: "[pre-commit] Update hooks versions"
43
+ committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
44
+ author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
45
+ body: |
46
+ 🤖 This PR was created automatically by the update-pre-commit workflow.
47
+ branch: update-pre-commit-hooks
48
+ base: master
49
+ delete-branch: true
50
+ labels: |
51
+ dependencies
Original file line number Diff line number Diff line change
1
+ name: Update pre-commit hooks
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 0 * * *'
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+ actions: write
12
+ checks: write
13
+ repository-projects: write
14
+
15
+ jobs:
16
+ update-pre-commit:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout repository
20
+ uses: actions/checkout@v4
21
+ - name: Update pre-commit hooks
22
+ uses: ./.github/actions/update-precommit
23
+ with:
24
+ token: ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments