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