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

Method forceMergePR

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

Source from the content-addressed store, hash-verified

1382 }
1383
1384 async forceMergePR(pullRequest: GitHubPull) {
1385 const result = await this.getDifferences(pullRequest.base.sha, pullRequest.head.sha);
1386 const files = getTreeFiles(result.files as GitHubCompareFiles);
1387
1388 let commitMessage = 'Automatically generated. Merged on Decap CMS\n\nForce merge of:';
1389 files.forEach((file: TreeFileForUpdate) => {
1390 commitMessage += `\n* "${file.path}"`;
1391 });
1392 console.log(
1393 '%c Automatic merge not possible - Forcing merge.',
1394 'line-height: 30px;text-align: center;font-weight: bold',
1395 );
1396 return this.getDefaultBranch()
1397 .then(branchData => this.updateTree(branchData.commit.sha, files))
1398 .then(changeTree => this.commit(commitMessage, changeTree))
1399 .then(response => this.patchBranch(this.branch, response.sha));
1400 }
1401
1402 toBase64(str: string) {
1403 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