From 67764ed1aebe96e42ad60b38fd7caca755e2cfe6 Mon Sep 17 00:00:00 2001 From: Julian Hofer Date: Tue, 25 Aug 2026 07:33:36 +0000 Subject: [PATCH] ci: approve dependabot PRs so auto-merge can go through The ruleset on `main` requires one approving review. The auto-merge workflow only enabled auto-merge, so every dependabot PR sat there waiting for a review that never came and I ended up approving them by hand anyway. - Approve the PR with `gh pr review --approve` before enabling auto-merge - Move the job into `checks.yml` and gate it on `needs: [checks]`, so the approval only happens once the build is green - Drop `dependabot-auto-merge.yml` Major bumps stay excluded, and the actor check stays on `github.event.pull_request.user.login` instead of `github.actor` so re-running the workflow myself doesn't turn auto-merge off. This relies on "Allow GitHub Actions to create and approve pull requests", which is already enabled on the repo. --- .github/workflows/checks.yml | 22 ++++++++++++++++++++ .github/workflows/dependabot-auto-merge.yml | 23 --------------------- 2 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 .github/workflows/dependabot-auto-merge.yml diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 2fc5704c..e0f1996e 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -16,3 +16,25 @@ jobs: - uses: prefix-dev/setup-pixi@f00437f565399d418b0acc85936d12c1fb668347 # v0.10.1 - run: pixi run lint - run: pixi run build-docs + + dependabot: + needs: [checks] + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' + permissions: + contents: write + pull-requests: write + steps: + - name: Fetch dependabot metadata + id: metadata + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Approve and enable auto-merge + if: steps.metadata.outputs.update-type != 'version-update:semver-major' + run: | + gh pr review --approve "$PR_URL" + gh pr merge --auto --squash "$PR_URL" + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml deleted file mode 100644 index d579b44c..00000000 --- a/.github/workflows/dependabot-auto-merge.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Dependabot auto-merge -on: pull_request - -permissions: - contents: write - pull-requests: write - -jobs: - auto-merge: - runs-on: ubuntu-latest - if: github.event.pull_request.user.login == 'dependabot[bot]' - steps: - - name: Fetch dependabot metadata - id: metadata - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Enable auto-merge - if: steps.metadata.outputs.update-type != 'version-update:semver-major' - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}