Skip to content

Update Pre-commit Hooks Versions #10

Update Pre-commit Hooks Versions

Update Pre-commit Hooks Versions #10

name: Update Pre-commit Hooks Versions
on:
schedule:
- cron: "51 5 * * 1" # Every Monday morning
workflow_dispatch: # Manual trigger
permissions:
contents: write
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Python set up
uses: actions/setup-python@v5
with:
python-version: "3.12"
# pre-commit has its own cache
# cache: "pip"
- name: Install pre-commit
run: |
pip install pre-commit
- name: Run pre-commit autoupdate
run: |
pre-commit autoupdate
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1
- name: Commit changes if any
run: |
if [[ $(git status --porcelain) ]]; then
git config --local user.name "GitHub Action"
git config --local user.email "action@github.com"
git commit -am "Update .pre-commit-config.yaml"
git push
fi