From 52a0a3186036a977a5d4a0f896152e253c060849 Mon Sep 17 00:00:00 2001 From: Marco Schaeck Date: Fri, 21 Aug 2026 13:56:43 +0200 Subject: [PATCH] ci: auto-merge Dependabot patch and minor updates --- .github/workflows/dependabot-automerge.yml | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/dependabot-automerge.yml diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml new file mode 100644 index 0000000..4dfd375 --- /dev/null +++ b/.github/workflows/dependabot-automerge.yml @@ -0,0 +1,34 @@ +# Auto-merge Dependabot patch/minor updates once the required checks pass; majors stay manual. +name: Dependabot auto-merge + +on: pull_request + +# Least privilege: only what enabling auto-merge on a PR needs. +permissions: + contents: write + pull-requests: write + +jobs: + auto-merge: + if: github.actor == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + + - name: Fetch Dependabot metadata + id: meta + uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Enable auto-merge for patch and minor updates + if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor' + run: | + for i in 1 2 3 4 5; do + gh pr merge --auto --squash "$PR_URL" && exit 0 + echo "enablePullRequestAutoMerge race (attempt $i) — retrying in 15s…" + sleep 15 + done + exit 1 + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}