Skip to content

Auto-close linked issues when external PRs are merged via bot #557

@IrvingMg

Description

@IrvingMg

Description

When an external PR includes closing keywords (e.g. Fixes #N), the referenced issue is not automatically closed after merge.

This happens because external PRs are first merged into an intermediate branch (main-pr<N>) instead of main. GitHub only auto-closes issues when changes are merged into the default branch.
See: https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#about-linked-issues-and-pull-requests

The "Merge External PR" created by the pr-merge.yml workflow merges the intermediate branch into main, but it does not preserve the closing keywords from the original PR body.

Example

PR #545 includes Fixes #207, but after it is merged, issue #207 remains open.

Proposed solution

Update .github/workflows/pr-merge.yml to extract closing keywords (Fixes, Closes, Resolves) from the original PR body and include them in the merge PR body.

Since the merge PR targets main, GitHub should process these keywords and automatically close the referenced issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIRelated to testingbugSomething isn't working

    Type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions