Head branch not automatically deleted when merged


I’ve enabled the Automatically delete head branches option and it works when I close pull requests manually from the UI but, when a GitHub Action does it with a GITHUB_TOKEN through this REST endpoint, the pull request head branch is not deleted. This looks like a bug.


Hi @tibdex,

Thanks for being here and our apologies for the delayed response. We are looking into this report and will post any updates here. Thanks again for taking the time to report.

Hi @andreagriffiths11, any updates?

I believe the issue is more general than merging via GitHub Actions. The head branch is also not being auto-deleted when the pull request is merged through the API (e.g. https://developer.github.com/v3/repos/merging/#perform-a-merge). I’m only seeing the head branch of a pull request being auto-deleted if I click the “merge” button in the GitHub UI.




This still seems to be an issue. We use workflows to merge some pull requests as part of our release automation. Unfortunately the head branches remain in existence after the merge, and because they are protected we can’t just delete them through the GitHub UI without temporarily disabling the protection. Whether a branch is merged via UI or API shouldn’t make a difference and both should delete the branch if the option is enabled.

Any Update for this issue???