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

Method forceMergePR

packages/decap-cms-backend-github/src/API.ts:1410–1426  ·  view source on GitHub ↗
(pullRequest: GitHubPull)

Source from the content-addressed store, hash-verified

1408 }
1409
1410 async forceMergePR(pullRequest: GitHubPull) {
1411 const result = await this.getDifferences(pullRequest.base.sha, pullRequest.head.sha);
1412 const files = getTreeFiles(result.files as GitHubCompareFiles);
1413
1414 let commitMessage = 'Automatically generated. Merged on Decap CMS\n\nForce merge of:';
1415 files.forEach((file: TreeFileForUpdate) => {
1416 commitMessage += `\n* "${file.path}"`;
1417 });
1418 console.log(
1419 '%c Automatic merge not possible - Forcing merge.',
1420 'line-height: 30px;text-align: center;font-weight: bold',
1421 );
1422 return this.getDefaultBranch()
1423 .then(branchData => this.updateTree(branchData.commit.sha, files))
1424 .then(changeTree => this.commit(commitMessage, changeTree))
1425 .then(response => this.patchBranch(this.branch, response.sha));
1426 }
1427
1428 toBase64(str: string) {
1429 return Promise.resolve(Base64.encode(str));

Callers 1

mergePRMethod · 0.95

Calls 6

getDifferencesMethod · 0.95
getDefaultBranchMethod · 0.95
updateTreeMethod · 0.95
commitMethod · 0.95
patchBranchMethod · 0.95
getTreeFilesFunction · 0.85

Tested by

no test coverage detected