Update pre-commit config #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Update pre-commit config" | |
on: | |
schedule: | |
- cron: "0 7 * * 1" # At 07:00 on each Monday. | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
update-pre-commit: | |
permissions: | |
contents: write # for technote-space/create-pr-action to push code | |
pull-requests: write # for technote-space/create-pr-action to create a PR | |
if: github.repository_owner == 'glotaran' | |
name: Autoupdate pre-commit config | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pre-commit | |
~/.cache/pip | |
key: pre-commit-autoupdate | |
- name: Update pre-commit config packages | |
uses: technote-space/create-pr-action@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
EXECUTE_COMMANDS: | | |
pip install pre-commit | |
pre-commit autoupdate || (exit 0); | |
pre-commit run -a || (exit 0); | |
COMMIT_MESSAGE: "⬆️ UPGRADE: Autoupdate pre-commit config" | |
PR_BRANCH_NAME: "pre-commit-config-update-${PR_ID}" | |
PR_TITLE: "⬆️ UPGRADE: Autoupdate pre-commit config" |