Skip to content

Commit

Permalink
Add workflow to update pre-commit.yaml (#78)
Browse files Browse the repository at this point in the history
fixes #33
  • Loading branch information
Cadair committed Apr 17, 2024
2 parents 483bd57 + a97b7c5 commit 465654f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/pre-commit-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Update template pre-commit
permissions:
contents: write
pull-requests: write

on:
# Allow manual runs through the web UI
workflow_dispatch:
schedule:
# ┌───────── minute (0 - 59)
# │ ┌───────── hour (0 - 23)
# │ │ ┌───────── day of the month (1 - 31)
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT)
- cron: '0 7 * * 1' # Every Monday at 7am UTC

jobs:
update:
runs-on: ubuntu-latest
strategy:
fail-fast: true

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-python@v5

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit update
id: check
run: pre-commit autoupdate -c '{{ cookiecutter.package_name }}/.pre-commit-config.yaml'

- name: Create pull request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
delete-branch: true
branch-suffix: timestamp
title: "pre-commit updates in the template"
body: |
This is an autogenerated PR, which updates the `{{ cookiecutter.package_name }}/.pre-commit-config.yaml` file.
1 change: 1 addition & 0 deletions {{ cookiecutter.package_name }}/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{# Note that this file must be valid yaml (and not only after rendering by jinja) so that pre-commit can autoupdate it. #}
repos:
# This should be before any formatting hooks like isort
- repo: https://github.com/astral-sh/ruff-pre-commit
Expand Down

0 comments on commit 465654f

Please sign in to comment.