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

Method getBranchPullRequest

packages/decap-cms-backend-forgejo/src/API.ts:650–666  ·  view source on GitHub ↗
(branchName: string)

Source from the content-addressed store, hash-verified

648 }
649
650 async getBranchPullRequest(branchName: string): Promise<ForgejoPullRequest> {
651 if (this.useOpenAuthoring) {
652 const headRef = await this.getHeadReference(branchName);
653 const pullRequests = await this.getPullRequests('all', headRef);
654 const result = await this.getOpenAuthoringPullRequest(branchName, pullRequests);
655 return result.pullRequest;
656 }
657
658 const pullRequests = await this.getPullRequests('open', `${this.repoOwner}:${branchName}`);
659 const cmsPullRequests = pullRequests.filter(pr =>
660 pr.labels.some(l => isCMSLabel(l.name, this.cmsLabelPrefix)),
661 );
662 if (cmsPullRequests.length > 0) {
663 return cmsPullRequests[0];
664 }
665 throw new EditorialWorkflowError('content is not under editorial workflow', true);
666 }
667
668 async getHeadReference(head: string) {
669 return `${this.repoOwner}:${head}`;

Callers 6

APIClass · 0.95
API.spec.jsFile · 0.45

Calls 6

getHeadReferenceMethod · 0.95
getPullRequestsMethod · 0.95
isCMSLabelFunction · 0.90
filterMethod · 0.80
someMethod · 0.80

Tested by

no test coverage detected