Update pre-commit config #161
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" | |
# You need to set an access token as a secret ACTION_TRIGGER_TOKEN on this repo | |
# in order for the PR to trigger the CI. | |
# For more details see: https://github.com/technote-space/create-pr-action#github_token | |
# If you don't want the PR to trigger the CI (NOT RECOMMENDED), comment out the GITHUB_TOKEN line. | |
on: | |
schedule: | |
- cron: "0 7 * * 1" # At 07:00 on each Monday. | |
workflow_dispatch: | |
jobs: | |
update-pre-commit: | |
if: github.repository_owner == 's-weigand' | |
name: Autoupdate pre-commit config | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.7 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pre-commit | |
key: pre-commit-autoupdate | |
- name: Update pre-commit config packages | |
uses: technote-space/create-pr-action@v2 | |
with: | |
GITHUB_TOKEN: ${{ secrets.ACTION_TRIGGER_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" |