From a7c655ec6725756bf0b3d2f26c69d03531266900 Mon Sep 17 00:00:00 2001 From: Mike Date: Sun, 1 Oct 2023 14:07:25 -0400 Subject: [PATCH] Avoid opening multiple PRs for pre-commit updates This moves pre-commit updates to a github action that runs monthly. This has the advantage of including *all* updates in a single PR. --- .github/workflows/pre-commit-autoupdate.yml | 44 +++++++++++++++++++++ renovate.json | 4 -- 2 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pre-commit-autoupdate.yml diff --git a/.github/workflows/pre-commit-autoupdate.yml b/.github/workflows/pre-commit-autoupdate.yml new file mode 100644 index 00000000..a95f29d3 --- /dev/null +++ b/.github/workflows/pre-commit-autoupdate.yml @@ -0,0 +1,44 @@ +name: pre-commit autoupdate + +on: + schedule: + - cron: 0 0 1 * * # first day of the month + workflow_dispatch: + +jobs: + pre-commit-autoupdate: + name: Update pre-commit hooks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version-file: '.python-version' + check-latest: true + + - name: Upgrade `pip` + run: python -m pip install --upgrade pip + + - name: Install pre-commit + run: pip install pre-commit + + - name: Update pre-commit hooks + run: pre-commit autoupdate + + - name: Open a pull request + id: create-pr + uses: peter-evans/create-pull-request@v5 + with: + add-paths: .pre-commit-config.yaml + commit-message: '[pre-commit] automatic update' + title: '[pre-commit] automatic update' + body: '' + + - name: Enable pull request automerge + if: steps.create-pr.outputs.pull-request-operation == 'created' + uses: peter-evans/enable-pull-request-automerge@v3 + with: + pull-request-number: ${{ steps.create-pr.outputs.pull-request-number }} + merge-method: squash diff --git a/renovate.json b/renovate.json index ed1df48e..49f59317 100644 --- a/renovate.json +++ b/renovate.json @@ -3,13 +3,9 @@ "extends": [ "config:base" ], - "pre-commit": { - "enabled": true - }, "packageRules": [ { "matchFileNames": [ - ".pre-commit-config.yaml", ".github/workflows/**" ], "automerge": true,