Skip to content

Update pre-commit hooks #789

Update pre-commit hooks

Update pre-commit hooks #789

name: Update pre-commit hooks
on:
workflow_dispatch:
schedule:
# Run at 8:00 AM every day
- cron: "0 8 * * *"
permissions:
contents: read # Required: checkout repositories
pull-requests: write # Required: create pull requests
jobs:
update-pre-commit-hooks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405
with:
python-version: "3.13"
- name: Install prerequisites
run: |
pip install pre-commit tox
- name: Update pre-commit hooks
run: |
pre-commit autoupdate
- name: Check for pre-commit config file changes
id: git_diff
run: |
echo "GIT_DIFF=$(git diff --exit-code 1> /dev/null; echo $?)" >> $GITHUB_OUTPUT
- name: Run tests
if: steps.git_diff.outputs.GIT_DIFF == 1
# We want to make sure that the new updates do not affect the code
run: |
make tests
- name: Create Pull Request
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "build: Update pre-commit hooks"
branch: "rstuf-bot/update-pre-commit-hooks"
delete-branch: true
title: "build: Update pre-commit hooks"
body: >
The following PR updates the pre-commit hooks (`.pre-commit-config.yaml` file) using `pre-commit autoupdate`.
labels: report, automated pr, pre-commit