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

Method mergePR

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

Source from the content-addressed store, hash-verified

1386 }
1387
1388 async mergePR(pullrequest: GitHubPull) {
1389 console.log('%c Merging PR', 'line-height: 30px;text-align: center;font-weight: bold');
1390 try {
1391 const result: Endpoints['PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge']['response']['data'] =
1392 await this.request(`${this.originRepoURL}/pulls/${pullrequest.number}/merge`, {
1393 method: 'PUT',
1394 body: JSON.stringify({
1395 commit_message: MERGE_COMMIT_MESSAGE,
1396 sha: pullrequest.head.sha,
1397 merge_method: this.mergeMethod,
1398 }),
1399 });
1400 return result;
1401 } catch (error) {
1402 if (error instanceof APIError && error.status === 405) {
1403 return this.forceMergePR(pullrequest);
1404 } else {
1405 throw error;
1406 }
1407 }
1408 }
1409
1410 async forceMergePR(pullRequest: GitHubPull) {
1411 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