Skip to content

Instantly share code, notes, and snippets.

@ArthurKun21
Created April 9, 2025 01:09
Show Gist options
  • Save ArthurKun21/4ee19910141a921bf3cf841a40041efe to your computer and use it in GitHub Desktop.
Save ArthurKun21/4ee19910141a921bf3cf841a40041efe to your computer and use it in GitHub Desktop.
Update the pre-commit hook
name: Pre-commit Auto-Update
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at 00:00 UTC
workflow_dispatch: # Manual trigger
jobs:
autoupdate:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install pre-commit
run: pip install pre-commit
- name: Run pre-commit auto-update
run: pre-commit autoupdate
- name: Commit changes
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -b autoupdate/pre-commit || git checkout autoupdate/pre-commit
git add .pre-commit-config.yaml || true
git diff --cached --quiet || git commit -m "chore: update pre-commit hook versions"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
branch: autoupdate/pre-commit
title: "chore: update pre-commit hook versions"
commit-message: "chore: update pre-commit hook versions"
body: |
This PR was automatically generated by a GitHub Action to update pre-commit hook versions.
delete-branch: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment