-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Avoid opening multiple PRs for pre-commit updates
This moves pre-commit updates to a github action that runs monthly. This has the advantage of including *all* updates in a single PR.
- Loading branch information
Showing
2 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: pre-commit autoupdate | ||
|
||
on: | ||
schedule: | ||
- cron: 0 0 1 * * # first day of the month | ||
workflow_dispatch: | ||
|
||
jobs: | ||
pre-commit-autoupdate: | ||
name: Update pre-commit hooks | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version-file: '.python-version' | ||
check-latest: true | ||
|
||
- name: Upgrade `pip` | ||
run: python -m pip install --upgrade pip | ||
|
||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
|
||
- name: Update pre-commit hooks | ||
run: pre-commit autoupdate | ||
|
||
- name: Open a pull request | ||
id: create-pr | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
add-paths: .pre-commit-config.yaml | ||
commit-message: '[pre-commit] automatic update' | ||
title: '[pre-commit] automatic update' | ||
body: '' | ||
|
||
# TODO: figure out how to enable this | ||
# - name: Enable pull request automerge | ||
# if: steps.create-pr.outputs.pull-request-operation == 'created' | ||
# uses: peter-evans/enable-pull-request-automerge@v3 | ||
# with: | ||
# pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} | ||
# merge-method: squash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters