File tree Expand file tree Collapse file tree 2 files changed +79
-0
lines changed Expand file tree Collapse file tree 2 files changed +79
-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 > autoupdate.log 2>&1
26+ cat 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+ body : |
44+ This PR updates the pre-commit hook versions to their latest releases.
45+
46+ Updates:
47+ ```
48+ $(grep "updating" autoupdate.log || echo "No updates found")
49+ ```
50+
51+ 🤖 This PR was created automatically by the update-pre-commit workflow.
52+ branch : update-pre-commit-hooks
53+ delete-branch : true
54+ labels : |
55+ dependencies
56+ 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+
13+ jobs :
14+ update-pre-commit :
15+ runs-on : ubuntu-latest
16+ steps :
17+ - name : Checkout repository
18+ uses : actions/checkout@v4
19+
20+ - name : Update pre-commit hooks
21+ uses : ./.github/actions/update-precommit
22+ with :
23+ token : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments