Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion ng-dev/pr/merge/strategies/api-merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,25 @@ export class GithubApiMergeStrategy extends MergeStrategy {

this.pushTargetBranchesUpstream(cherryPickTargetBranches);

/** The local branch names of the github targeted branches. */
const banchesAndSha: [branchName: string, commitSha: string][] = targetBranches.map(
(targetBranch) => {
const localBranch = this.getLocalTargetBranchName(targetBranch);

/** The SHA of the commit pushed to github which represents closing the PR. */
const sha = this.git.run(['rev-parse', localBranch]).stdout.trim();
return [targetBranch, sha];
},
);
// Because our process brings changes into multiple branchces, we include a comment which
// expresses all of the branches the changes were merged into.
await this.git.github.issues.createComment({
...this.git.remoteParams,
issue_number: pullRequest.prNumber,
body: `The changes were merged into the following branches: ${targetBranches.join(', ')}`,
body:
'This PR was merged into the repository. ' +
'The changes were merged into the following branches:\n\n' +
`${banchesAndSha.map(([branch, sha]) => `- ${branch}: ${sha}`).join('\n')}`,
});
}

Expand Down
20 changes: 14 additions & 6 deletions ng-dev/pr/merge/strategies/autosquash-merge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ export class AutosquashMergeStrategy extends MergeStrategy {
// Push the cherry picked branches upstream.
this.pushTargetBranchesUpstream(targetBranches);

/** The local branch name of the github targeted branch. */
const localBranch = this.getLocalTargetBranchName(githubTargetBranch);
/** The SHA of the commit pushed to github which represents closing the PR. */
const sha = this.git.run(['rev-parse', localBranch]).stdout.trim();
/** The local branch names of the github targeted branches. */
const banchesAndSha: [branchName: string, commitSha: string][] = targetBranches.map(
(targetBranch) => {
const localBranch = this.getLocalTargetBranchName(targetBranch);

/** The SHA of the commit pushed to github which represents closing the PR. */
const sha = this.git.run(['rev-parse', localBranch]).stdout.trim();
return [targetBranch, sha];
},
);

// Allow user to set an amount of time to wait to account for rate limiting of the token usage
// during merge otherwise just waits 0 seconds.
await new Promise((resolve) =>
Expand All @@ -100,8 +107,9 @@ export class AutosquashMergeStrategy extends MergeStrategy {
...this.git.remoteParams,
issue_number: pullRequest.prNumber,
body:
`This PR was merged into the repository by commit ${sha}.\n\n` +
`The changes were merged into the following branches: ${targetBranches.join(', ')}`,
'This PR was merged into the repository. ' +
'The changes were merged into the following branches:\n\n' +
`${banchesAndSha.map(([branch, sha]) => `- ${branch}: ${sha}`).join('\n')}`,
});

// For PRs which do not target the `main` branch on Github, Github does not automatically
Expand Down