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

Method getBranchPullRequest

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

Source from the content-addressed store, hash-verified

655 }
656
657 async getBranchPullRequest(branchName: string): Promise<ForgejoPullRequest> {
658 if (this.useOpenAuthoring) {
659 const headRef = await this.getHeadReference(branchName);
660 const pullRequests = await this.getPullRequests('all', headRef);
661 const result = await this.getOpenAuthoringPullRequest(branchName, pullRequests);
662 return result.pullRequest;
663 }
664
665 const pullRequests = await this.getPullRequests('open', `${this.repoOwner}:${branchName}`);
666 const cmsPullRequests = pullRequests.filter(pr =>
667 pr.labels.some(l => isCMSLabel(l.name, this.cmsLabelPrefix)),
668 );
669 if (cmsPullRequests.length > 0) {
670 return cmsPullRequests[0];
671 }
672 throw new EditorialWorkflowError('content is not under editorial workflow', true);
673 }
674
675 async getHeadReference(head: string) {
676 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