Auto-link Github PR to issue and close issue when PR gets merged

Viewed 71

When I create a branch from an issue (like the below image) and then create a PR from that branch to main branch, I expect the PR to be linked to that issue and close the issue when the PR gets merged. But, unfortunately, that's not happening.

enter image description here

Github says, I can link a PR to an issue using a supported keyword in the pull request description like Closes #10 (issue number). Is there a way to avoid this manual step because the branch with PR is already linked to the issue?

1 Answers

When you make a branch directly from the issue when a PR is opened with that branch it will automatically be linked. And I just tested this out and it should be working.

It says in the GH docs:

Branches connected to an issue are shown under the "Development" section in the sidebar of an issue. When you create a pull request for one of these branches, it is automatically linked to the issue. The connection with that branch is removed and only the pull request is shown in the "Development" section. For more information, see "Linking a pull request to an issue."

The above quote is from this help article.

Related