-
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.
build: auto update pre-commit configs
- Loading branch information
1 parent
4eab845
commit 17f149f
Showing
1 changed file
with
49 additions
and
0 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,49 @@ | ||
# based on https://github.com/cookiecutter/cookiecutter-django/blob/master/ | ||
# .github/workflows/pre-commit-autoupdate.yml | ||
# run pre-commit autoupdate and create a pull request if any changes | ||
|
||
name: pre-commit auto-update | ||
|
||
on: | ||
schedule: | ||
- cron: "0 6 * * 1" # every Monday at 06:00 UTC | ||
workflow_dispatch: # to trigger manually | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
auto-update: | ||
# disables this workflow from running in a repository that is not part of | ||
# the indicated organization/user | ||
if: github.repository_owner == 'martibosch' | ||
permissions: | ||
contents: write # for peter-evans/create-pull-request to create branch | ||
pull-requests: write # for peter-evans/create-pull-request to create PR | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: install pre-commit | ||
run: pip install pre-commit | ||
|
||
- name: autoupdate template | ||
run: pre-commit autoupdate | ||
|
||
- name: autoupdate generated projects | ||
working-directory: "{{ cookiecutter.repo_name }}" | ||
run: pre-commit autoupdate | ||
|
||
- name: create pull request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: update/pre-commit-autoupdate | ||
title: auto-update pre-commit hooks | ||
commit-message: "build: auto-update pre-commit hooks" | ||
body: update to latest versions in pre-commit configs | ||
labels: update |