Skip to content

Commit

Permalink
build: auto update pre-commit configs
Browse files Browse the repository at this point in the history
  • Loading branch information
martibosch committed Dec 11, 2023
1 parent 4eab845 commit 17f149f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yaml
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

0 comments on commit 17f149f

Please sign in to comment.