MCPcopy Create free account
hub / github.com/decaporg/decap-cms / mergePR

Method mergePR

packages/decap-cms-backend-github/src/API.ts:1362–1382  ·  view source on GitHub ↗
(pullrequest: GitHubPull)

Source from the content-addressed store, hash-verified

1360 }
1361
1362 async mergePR(pullrequest: GitHubPull) {
1363 console.log('%c Merging PR', 'line-height: 30px;text-align: center;font-weight: bold');
1364 try {
1365 const result: Endpoints['PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge']['response']['data'] =
1366 await this.request(`${this.originRepoURL}/pulls/${pullrequest.number}/merge`, {
1367 method: 'PUT',
1368 body: JSON.stringify({
1369 commit_message: MERGE_COMMIT_MESSAGE,
1370 sha: pullrequest.head.sha,
1371 merge_method: this.mergeMethod,
1372 }),
1373 });
1374 return result;
1375 } catch (error) {
1376 if (error instanceof APIError && error.status === 405) {
1377 return this.forceMergePR(pullrequest);
1378 } else {
1379 throw error;
1380 }
1381 }
1382 }
1383
1384 async forceMergePR(pullRequest: GitHubPull) {
1385 const result = await this.getDifferences(pullRequest.base.sha, pullRequest.head.sha);

Callers 1

Calls 2

requestMethod · 0.95
forceMergePRMethod · 0.95

Tested by

no test coverage detected