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

Method mergePR

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

Source from the content-addressed store, hash-verified

1399 }
1400
1401 async mergePR(pullrequest: GitHubPull) {
1402 console.log('%c Merging PR', 'line-height: 30px;text-align: center;font-weight: bold');
1403 try {
1404 const result: Endpoints['PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge']['response']['data'] =
1405 await this.request(`${this.originRepoURL}/pulls/${pullrequest.number}/merge`, {
1406 method: 'PUT',
1407 body: JSON.stringify({
1408 commit_message: MERGE_COMMIT_MESSAGE,
1409 sha: pullrequest.head.sha,
1410 merge_method: this.mergeMethod,
1411 }),
1412 });
1413 return result;
1414 } catch (error) {
1415 if (error instanceof APIError && error.status === 405) {
1416 return this.forceMergePR(pullrequest);
1417 } else {
1418 throw error;
1419 }
1420 }
1421 }
1422
1423 async forceMergePR(pullRequest: GitHubPull) {
1424 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