You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make the Merge-Bot Task's delete-branch Input Delete Heads After an Auto-Merge #2296
merge-bot-task.yml's delete-branch input appends --delete-branch to gh pr merge --auto. With --auto, the merge happens later on GitHub's side, once the required checks pass, and nothing deletes the head branch at that point. So for a repo that keeps repository-wide auto-delete off, the input has no effect, and the bot heads it exists to clean up stay behind.
Evidence
ptr727/homeassistant-purpleair keeps delete_branch_on_merge: false. Its carried merge-bot ran gh pr merge --auto --delete-branch --squash on the bot PR ptr727/homeassistant-purpleair#358. The PR auto-merged at 2026-10-03T02:08:30Z. Afterwards, git ls-remote origin refs/heads/ha-version-bump/matrix still returned df3a7e1, which is #358's merged headRefOid.
The hub task builds the same argument list (args=(--auto "$method"), then +=(--delete-branch)), so every adopter setting delete-branch: true inherits the gap.
Docs that describe the input as deleting bot heads:
docs/reusable-workflows.md, "Adopting the Merge-Bot"
the input's own description
the adopters' stub comments ("Bot heads are therefore deleted here explicitly")
Possible fixes
Delete the head after the merge actually lands, for example from a pull_request_target: closed job gated on merged == true, the bot author and the in-repo head, verifying the remote tip against the PR's headRefOid first.
Or drop the input and document that bot heads persist. A rolling branch like ha-version-bump/matrix is recreated by its tracker anyway, while Dependabot deletes its own branches.
Maintainer decision (2026-10-03): keep the delete-branch input and make it work. Delete the head from a pull_request_target closed path gated on merged, the bot author and an in-repo head, and only when the remote tip still equals the PR's headRefOid. Repository-wide delete_branch_on_merge stays off fleet-wide.
Activity
ptr727 commentedon Oct 4, 2026
Maintainer decision (2026-10-03): keep the
delete-branchinput and make it work. Delete the head from apull_request_targetclosed path gated on merged, the bot author and an in-repo head, and only when the remote tip still equals the PR'sheadRefOid. Repository-widedelete_branch_on_mergestays off fleet-wide.Delete Merge-Bot Heads From the Closed Event and Split the Stub Concu…