Skip to content

fix(ci): arm dependabot auto-merge with an app token so the merge queue actually enrolls - #42

Merged
githubrobbi merged 1 commit into
mainfrom
fix/automerge-app-token
Jul 13, 2026
Merged

fix(ci): arm dependabot auto-merge with an app token so the merge queue actually enrolls#42
githubrobbi merged 1 commit into
mainfrom
fix/automerge-app-token

Conversation

@githubrobbi

@githubrobbi githubrobbi commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Problem

Dependabot PRs #40/#41 sat CLEAN with auto-merge enabled for 7+ hours and never merged. The timeline shows an AutoMergeEnabledEvent but no AddedToMergeQueueEvent — auto-merge armed via the default GITHUB_TOKEN never enrolls in the merge queue, per GitHub's anti-loop design (the same limitation release-plz.yml already documents for tag pushes). They needed a manual enqueuePullRequest nudge.

Fix

  • Mint a GitHub App installation token via actions/create-github-app-token (SHA-pinned, v3.2.0) when APP_ID/APP_PRIVATE_KEY are configured, and arm gh pr merge --auto with it. Reuses the repo-wide app-credential names release-plz.yml designates as the canonical pattern.
  • Fall back to GITHUB_TOKEN when the secrets are absent (fresh template clone) — identical to pre-fix behavior, zero regression.
  • Header comment documents the root cause and the setup runbook, including the footgun that this workflow runs on Dependabot-actor events and therefore reads the Dependabot secrets store (gh secret set APP_ID --app dependabot), not the Actions one.

Verification

  • actionlint clean (it caught that secrets isn't legal in step-level if:; hoisted to job-level env).
  • Behavioral proof requires the app credentials + a live Dependabot PR; until the secrets are set, the mint step is skipped and the workflow is byte-for-byte the old behavior.

…ue actually enrolls

Auto-merge armed via the default GITHUB_TOKEN records an
AutoMergeEnabledEvent but never enrolls in the merge queue (GitHub
anti-loop design; same limitation release-plz.yml documents for tag
pushes). Observed on #40/#41: both CLEAN with auto-merge enabled for
7+ hours, queue empty.

Mint an installation token via actions/create-github-app-token when
the APP_ID/APP_PRIVATE_KEY credentials exist (Dependabot secrets
store - this runs on Dependabot-actor pull_request events) and arm
auto-merge with that; fall back to GITHUB_TOKEN (pre-fix behavior,
manual enqueue nudge) when absent, so fresh template clones are not
broken.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@githubrobbi
githubrobbi added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit ca1ed67 Jul 13, 2026
20 checks passed
@githubrobbi
githubrobbi deleted the fix/automerge-app-token branch July 13, 2026 23:17
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