From 314c37aa2007440793b2c3c117d6a143647ac4a8 Mon Sep 17 00:00:00 2001 From: chriopter <82179548+chriopter@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:00:10 +0100 Subject: [PATCH 1/2] Merge Dependabot's pull requests once their checks are green --- .github/workflows/dependabot.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/dependabot.yml diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 0000000..9b9ee19 --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,26 @@ +name: dependabot + +# Dependabot's pull requests merge themselves: auto-merge is enabled on each, +# and GitHub squashes it into main once the required test and gui checks are +# green. A major version that breaks the build stays open until it is fixed +# by hand. The push to main then publishes a development build. +on: + pull_request_target: + types: [opened, reopened, synchronize] + +permissions: + contents: write + pull-requests: write + +jobs: + auto-merge: + if: github.event.pull_request.user.login == 'dependabot[bot]' + runs-on: ubuntu-latest + steps: + - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 + id: meta + - name: Enable auto-merge + env: + GH_TOKEN: ${{ github.token }} + PR: ${{ github.event.pull_request.html_url }} + run: gh pr merge "$PR" --auto --squash From 06f2b1f1423f9823a0ac0444813b048494831e0a Mon Sep 17 00:00:00 2001 From: chriopter <82179548+chriopter@users.noreply.github.com> Date: Mon, 23 Nov 2026 12:01:05 +0100 Subject: [PATCH 2/2] Merge Dependabot's pull requests once ci is green --- .github/workflows/dependabot.yml | 40 +++++++++++++++++++++----------- .github/workflows/release.yml | 5 ++-- AGENTS.md | 3 +++ 3 files changed, 33 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 9b9ee19..cb26ef8 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -1,26 +1,40 @@ name: dependabot -# Dependabot's pull requests merge themselves: auto-merge is enabled on each, -# and GitHub squashes it into main once the required test and gui checks are -# green. A major version that breaks the build stays open until it is fixed -# by hand. The push to main then publishes a development build. +# Dependabot's pull requests merge themselves once ci is green on the very +# commit it checked; one that breaks the build (often a major version) stays +# open until it is fixed by hand. A merge made with the workflow token starts +# no push workflows, so this one starts the development build itself. on: - pull_request_target: - types: [opened, reopened, synchronize] + workflow_run: + workflows: [ci] + types: [completed] permissions: contents: write pull-requests: write + actions: write jobs: - auto-merge: - if: github.event.pull_request.user.login == 'dependabot[bot]' + merge: + if: >- + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' && + startsWith(github.event.workflow_run.head_branch, 'dependabot/') && + github.event.workflow_run.head_repository.full_name == github.repository runs-on: ubuntu-latest + concurrency: + group: dependabot-merge + cancel-in-progress: false steps: - - uses: dependabot/fetch-metadata@25dd0e34f4fe68f24cc83900b1fe3fe149efef98 # v3.1.0 - id: meta - - name: Enable auto-merge + - name: Merge env: GH_TOKEN: ${{ github.token }} - PR: ${{ github.event.pull_request.html_url }} - run: gh pr merge "$PR" --auto --squash + GH_REPO: ${{ github.repository }} + BRANCH: ${{ github.event.workflow_run.head_branch }} + SHA: ${{ github.event.workflow_run.head_sha }} + run: | + pr=$(gh pr list --head "$BRANCH" --state open --json number,author \ + --jq '.[] | select(.author.login == "app/dependabot") | .number') + [[ -n $pr ]] || { echo "No open Dependabot pull request for $BRANCH"; exit 0; } + gh pr merge "$pr" --squash --delete-branch --match-head-commit "$SHA" + gh workflow run release.yml --ref main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7e3bc2f..23ff018 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,10 +44,11 @@ jobs: GH_REPO: ${{ github.repository }} run: python3 .github/scripts/release_reminder.py - # Only a push can start the build and publication jobs: a tag names its + # Only a push or a manual start on main (the dependabot workflow uses it after + # merging) can start the build and publication jobs: a tag names its # release, main becomes the next patch version's development build. version: - if: github.event_name == 'push' + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') runs-on: ubuntu-latest outputs: tag: ${{ steps.version.outputs.tag }} diff --git a/AGENTS.md b/AGENTS.md index c7ab148..fe69b16 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -55,6 +55,9 @@ available". So they are short and plain: deletes the branch. - Contributors with write access merge their own pull requests the same way. Release tags are the maintainer's alone; see below. +- Dependabot's pull requests merge themselves (`.github/workflows/dependabot.yml`) + once ci is green, and start a development build. One that stays red + (usually a major version) waits to be fixed on its branch. ## Releases