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,