Skip to content

fix(automerge): never enqueue into a merge queue as GITHUB_TOKEN - #19

Merged
emkraan-deploy-bot[bot] merged 1 commit into
mainfrom
fix/automerge-never-enqueue-as-github-token
Sep 23, 2026
Merged

emkraan-deploy-bot[bot] merged 1 commit into
mainfrom
fix/automerge-never-enqueue-as-github-token

Conversation

@cmarko89

Copy link
Copy Markdown
Contributor

Summary

Removes the GITHUB_TOKEN fallback from merge-queue enqueue in reusable-automerge.yml. Enqueue now requires the deploy-bot app. If the app token is missing or the app is refused, the PR is skipped with a warning and retried by the next event or the sweep.

Root cause of the "merge queue hard-wedge"

A merge queue attributes the merge_group event to whoever enqueued the PR. GitHub starts no workflow runs from events caused by GITHUB_TOKEN, so an entry enqueued as github-actions never gets a merge_group CI run, never sees its required ci check, and sits at AWAITING_CHECKS until the timeout.

Evidence, 18 PRs across 3 repos (enqueuing actor versus merge_group runs formed):

Enqueued by PRs merge_group runs
a human (cmarko89) ha-shared-workflows #11 #12 #13, hubspace #23 #24, muninn #159, and #160 #161 #162 after a manual re-enqueue 1 each
github-actions only ha-shared-workflows #14 #15, hubspace #25 #26 #27 #28, muninn #163 #164 #165 0 each
emkraan-deploy-bot ha-shared-workflows #16 (verification, 2026-09-23) 1: merged by the queue in 51s

The HA integration repos looked healthy only because their Validate workflow also runs on push with no branch filter. The queue's push of gh-readonly-queue/... is by github-merge-queue[bot] (not suppressed), so that push run reported ci on the group commit. ha-shared-workflows' CI is pull_request + merge_group only, so nothing reported ci and it wedged. muninn #163/#164, documented on 2026-09-19 as a GitHub-side wedge, were the same cause.

The wedged enqueues all came from runs acting as github-actions: callers without app inputs, and workflow_run events, which run main's caller (it lacked the app until today's rollout). All callers now pass the app. This PR makes sure a missing or failed app token can never silently reintroduce the wedge.

Verification

  • A mocked run of the script: queue + app enqueues as the app (CLEAN and UNSTABLE-self); queue + no app is skipped loudly with no mutation; queue + app refused is not retried as the token; plain repos keep the token retry.
  • Live: docs(readme): add the merge_group trigger to the caller example ha-shared-workflows#16 was enqueued by emkraan-deploy-bot, its merge_group CI run formed 18s later, and the queue merged it 51s after enqueue.

A merge queue attributes the merge_group event to whoever enqueued, and GitHub starts no workflow runs from GITHUB_TOKEN-caused events, so a GITHUB_TOKEN enqueue gets no merge_group CI and wedges at AWAITING_CHECKS. Verified across 18 PRs in 3 repos. Enqueue now requires the deploy-bot app and is skipped loudly otherwise; plain-repo merges keep their GITHUB_TOKEN retry.
@emkraan-deploy-bot
emkraan-deploy-bot Bot enabled auto-merge (squash) September 23, 2026 16:11
@emkraan-deploy-bot
emkraan-deploy-bot Bot merged commit 386410d into main Sep 23, 2026
2 checks passed
@emkraan-deploy-bot
emkraan-deploy-bot Bot deleted the fix/automerge-never-enqueue-as-github-token branch September 23, 2026 16:11
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