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