MCPcopy Create free account
hub / github.com/angular/dev-infra / createMergeComment

Function createMergeComment

ng-dev/pr/merge/strategies/strategy.ts:205–228  ·  view source on GitHub ↗

Creates a comment on the pull request to indicate that the PR has been merged.

(
    pullRequest: PullRequest,
    targetBranches: string[],
  )

Source from the content-addressed store, hash-verified

203
204 /** Creates a comment on the pull request to indicate that the PR has been merged. */
205 protected async createMergeComment(
206 pullRequest: PullRequest,
207 targetBranches: string[],
208 ): Promise<void> {
209 /** The local branch names of the github targeted branches. */
210 const banchesAndSha: [branchName: string, commitSha: string][] = targetBranches.map(
211 (targetBranch) => {
212 const localBranch = this.getLocalTargetBranchName(targetBranch);
213
214 /** The SHA of the commit pushed to github which represents closing the PR. */
215 const sha = this.git.run(['rev-parse', localBranch]).stdout.trim();
216 return [targetBranch, sha];
217 },
218 );
219
220 await this.git.github.issues.createComment({
221 ...this.git.remoteParams,
222 issue_number: pullRequest.prNumber,
223 body:
224 'This PR was merged into the repository. ' +
225 'The changes were merged into the following branches:\n\n' +
226 `${banchesAndSha.map(([branch, sha]) => `- ${branch}: ${sha}`).join('\n')}`,
227 });
228 }
229
230 /**
231 * Manually closes issues linked to a merged Pull Request.

Callers

nothing calls this directly

Calls 1

runMethod · 0.45

Tested by

no test coverage detected