(branchName: string)
| 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}`; |
no test coverage detected