Skip to content

fix(ci): repair Dependabot auto-merge via native auto-merge - #281

Merged
StuartMeeks merged 1 commit into
mainfrom
bugfix/dependabot-auto-merge
Aug 6, 2026
Merged

fix(ci): repair Dependabot auto-merge via native auto-merge#281
StuartMeeks merged 1 commit into
mainfrom
bugfix/dependabot-auto-merge

Conversation

@StuartMeeks

Copy link
Copy Markdown
Owner

🤖 AI-generated PR — Please review carefully.

Why

The auto-merge workflow has not merged anything since late January. It posted @dependabot squash and merge on each pull request, but GitHub removed that command — along with @dependabot merge, cancel merge, close and reopen — on 27 January 2026.

Removed commands are ignored silently: no reply, no error. The job kept reporting success while Dependabot did nothing, so the breakage was invisible until nine pull requests had piled up (#271, #273#280).

What changed

Switch to GitHub's native auto-merge (gh pr merge --auto --squash), which queues the pull request and merges it as soon as the required checks pass. Scope is unchanged: patch and minor auto-merge, majors get the review comment.

Two smaller fixes ride along:

  • Missing-token guard. Until AUTOMERGE_TOKEN exists the workflow emits a ::warning:: instead of failing, so the gap is visible without painting every Dependabot PR red.
  • No more duplicate review notes. The major-version comment fired on synchronize too, so every Dependabot rebase repeated it — chore(deps): bump the production-dependencies group across 1 directory with 13 updates #273 collected three identical copies. It now only posts on opened/reopened.

Why a PAT rather than GITHUB_TOKEN

The main protection ruleset requires a code-owner approval (* @StuartMeeks), so only a bypass actor can merge unattended. Bypass is limited to the Admin role and the Dependabot app — and Dependabot can no longer perform merges.

Adding the GitHub Actions app was the obvious no-credential fix, but GitHub rejects it on a user-owned repository:

Actor GitHub Actions integration must be part of the ruleset source or owner organization

So the merge has to be enabled by a repository admin. AUTOMERGE_TOKEN is a fine-grained PAT scoped to this repository with Contents: read and write + Pull requests: read and write.

This clears only the review requirement. Auto-merge still waits for the required checks (build-test, validate-game-data), so a red build blocks the merge exactly as before.

Action required before this takes effect

Create the PAT and save it as the repository secret AUTOMERGE_TOKEN. Until then the workflow warns and Dependabot PRs need a manual merge — the same position as today, minus the silent failure.

Verification

actionlint 1.7.12 is clean on this workflow and on every other workflow in .github/workflows/. The runtime path cannot be exercised until the secret exists and Dependabot opens its next PR; the first real run is worth a look, in particular that the validate-game-data required check — which reports skipping on dependency-only PRs — is treated as satisfied by auto-merge.

No issue filed, per instruction.

The auto-merge workflow has not merged anything since late January. It
posted `@dependabot squash and merge` on each pull request, but GitHub
removed that command — along with `@dependabot merge`, `cancel merge`,
`close` and `reopen` — on 27 January 2026. Removed commands are ignored
silently, with no reply and no error, so the job kept reporting success
while Dependabot did nothing. Nine pull requests had accumulated.

Switch to GitHub's native auto-merge (`gh pr merge --auto --squash`),
which queues the pull request and merges it once the required checks
pass.

The merge is authenticated with AUTOMERGE_TOKEN, a fine-grained PAT, and
not GITHUB_TOKEN. The `main protection` ruleset requires a code-owner
approval, so only a bypass actor can merge unattended, and bypass is
limited to the Admin role and the Dependabot app. The GitHub Actions app
cannot be added on a user-owned repository — the API rejects it with
"Actor GitHub Actions integration must be part of the ruleset source or
owner organization" — so the merge must be enabled by an admin. This
clears only the review requirement: auto-merge still waits for
build-test and validate-game-data, so a red build blocks the merge.

Until the secret exists the workflow warns rather than failing, so a
missing token does not paint every Dependabot pull request red.

Also stop re-posting the major-version review note on `synchronize`. It
fired on every rebase, leaving three identical comments on #273.
@StuartMeeks
StuartMeeks merged commit 100ba4d into main Aug 6, 2026
7 checks passed
@StuartMeeks
StuartMeeks deleted the bugfix/dependabot-auto-merge branch August 6, 2026 12:51
StuartMeeks added a commit that referenced this pull request Aug 6, 2026
#281 restored the queuing half of auto-merge but not the merging half.
PR #282 proved it: every check green, statusCheckRollup SUCCESS,
auto-merge enabled nine seconds after Dependabot opened it — and still
BLOCKED, sitting at reviewDecision REVIEW_REQUIRED.

The `main protection` ruleset requires a code-owner approval, and the
assumption that a bypass actor could merge without one was wrong. Bypass
applies only to an interactive merge performed by that actor
(`gh pr merge --admin`); GitHub's auto-merge ignores bypass entirely and
waits for every merge requirement, review included. Approving #282 by
hand settled it — the queued merge completed on its own three seconds
later, with no other change.

Approve with AUTOMERGE_TOKEN before queuing the merge. CODEOWNERS makes
@StuartMeeks the owner of every path, and GITHUB_TOKEN cannot stand in:
the repository disallows Actions approvals and github-actions[bot] is
not a code owner. The approval re-runs on `synchronize` because the
ruleset dismisses stale reviews on push and requires the approval to
follow the last push.

Patch and minor bumps now merge without a human reading them. That is
what auto-merge means here, but it is a real change in review posture,
so the workflow header states it plainly. Majors still stop for review,
and required checks are never bypassed — auto-merge continues to wait
for build-test and validate-game-data.

Also correct the header comment from #281, which described the bypass
behaviour incorrectly.
StuartMeeks added a commit that referenced this pull request Aug 6, 2026
#281 restored the queuing half of auto-merge but not the merging half.
PR #282 proved it: every check green, statusCheckRollup SUCCESS,
auto-merge enabled nine seconds after Dependabot opened it — and still
BLOCKED, sitting at reviewDecision REVIEW_REQUIRED.

The `main protection` ruleset requires a code-owner approval, and the
assumption that a bypass actor could merge without one was wrong. Bypass
applies only to an interactive merge performed by that actor
(`gh pr merge --admin`); GitHub's auto-merge ignores bypass entirely and
waits for every merge requirement, review included. Approving #282 by
hand settled it — the queued merge completed on its own three seconds
later, with no other change.

Approve with AUTOMERGE_TOKEN before queuing the merge. CODEOWNERS makes
@StuartMeeks the owner of every path, and GITHUB_TOKEN cannot stand in:
the repository disallows Actions approvals and github-actions[bot] is
not a code owner. The approval re-runs on `synchronize` because the
ruleset dismisses stale reviews on push and requires the approval to
follow the last push.

Patch and minor bumps now merge without a human reading them. That is
what auto-merge means here, but it is a real change in review posture,
so the workflow header states it plainly. Majors still stop for review,
and required checks are never bypassed — auto-merge continues to wait
for build-test and validate-game-data.

Also correct the header comment from #281, which described the bypass
behaviour incorrectly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant