Skip to content

fix(ng-dev): close linked issues when merging via autosquash into main - #4066

Merged
alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:refactor/close-linked-issues
Oct 26, 2026
Merged

alan-agius4 merged 1 commit into
angular:mainfrom
alan-agius4:refactor/close-linked-issues

Conversation

@alan-agius4

Copy link
Copy Markdown
Contributor

When a pull request is merged via the autosquash merge strategy, it is closed via a PR Close #... commit message rather than merged via the GitHub API. Consequently, GitHub does not automatically close linked issues even when targeting the main branch.

This change moves closeLinkedIssues outside the githubTargetBranch !== this.git.mainBranchName guard in AutosquashMergeStrategy and removes the redundant main branch check in MergeStrategy.closeLinkedIssues.

When a pull request is merged via the autosquash merge strategy, it is closed via a `PR Close #...` commit message rather than merged via the GitHub API. Consequently, GitHub does not automatically close linked issues even when targeting the main branch. This change ensures `closeLinkedIssues` is called for all autosquash merges regardless of target branch.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the merge strategies to unconditionally close linked issues manually by moving the closeLinkedIssues call outside of a conditional block in AutosquashMergeStrategy and removing the main branch guard from the base MergeStrategy class. The review feedback points out that removing this guard globally may cause redundant API calls for other merge strategies. Instead, it is recommended to keep the main branch guard in the base class and introduce an optional force parameter to bypass it specifically for the autosquash merge strategy.

Comment thread ng-dev/pr/merge/strategies/strategy.ts
Comment thread ng-dev/pr/merge/strategies/autosquash-merge.ts
@alan-agius4 alan-agius4 added the action: merge The PR is ready for merge by the caretaker label Oct 26, 2026
@alan-agius4
alan-agius4 merged commit a651944 into angular:main Oct 26, 2026
20 of 21 checks passed
@alan-agius4

Copy link
Copy Markdown
Contributor Author

This PR was merged into the repository. The changes were merged into the following branches:

@alan-agius4
alan-agius4 deleted the refactor/close-linked-issues branch October 26, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants