Skip to content

date: 2026-06-05 tags: [github, workflow, integration-branch, pr] status: active graduated_to:

Closes #N fires only on merge to the default branch

Symptom — set up a long-lived integration branch (project-migration) with micro-PRs merging into it; expected each linked issue to close as its PR merged. They didn't.

Root cause — GitHub auto-closes an issue from a Closes #N trailer only when the PR merges into the repository's default branch (main). A PR whose base is a non-default branch (integration / epic / sprint branch) merges without touching the linked issue.

Fix / convention — in an integration-branch flow, linked issues stay open until the chain reaches main (the final project-migration → main PR closes them all). This is consistent with [[2026-06-04-issues-close-on-merge-not-commit]] ("nothing is done until merged to main") — just document it so an open issue after an intermediate merge isn't read as a miss. If per-layer closure is wanted, close manually (gh issue close) on the intermediate merge.

Update (ADR-0005) — for the sprint branch flow this per-layer closure is now automated: the .github/workflows/close-sprint-tasks.yml Action closes a Task issue when its work merges into a sprint/** branch (parsing the merged PR body, or commit trailers on a direct push), so Tasks no longer wait for main. The Sprint issue still closes natively on its Sprint PR → main; the Epic is closed by build-epic on completion. So the "stays open until main" caveat now applies to integration-style branches, not the sprint/epic flow.

Guard — noted on epic #148 and the build-epic / build-sprint cadence enhancements (#152 / #153); branch flow + completion semantics pinned in docs/adr/0005-sprint-epic-branch-flow-and-completion.md.