(pullRequest: ForgejoPullRequest, status: string)
| 768 | } |
| 769 | |
| 770 | async setPullRequestStatus(pullRequest: ForgejoPullRequest, status: string): Promise<void> { |
| 771 | // Skip label updates for open authoring as contributors don't have permission |
| 772 | // Also skip for mock PRs (no real PR exists yet) |
| 773 | if (this.useOpenAuthoring || pullRequest.number === MOCK_PULL_REQUEST) { |
| 774 | return; |
| 775 | } |
| 776 | |
| 777 | const newLabel = statusToLabel(status, this.cmsLabelPrefix); |
| 778 | |
| 779 | // Get or create the new status label |
| 780 | const label = await this.getOrCreateLabel(newLabel); |
| 781 | |
| 782 | if (typeof label.id !== 'number') { |
| 783 | throw new Error( |
| 784 | `Status label "${label.name}" returned from getOrCreateLabel is missing a numeric id`, |
| 785 | ); |
| 786 | } |
| 787 | |
| 788 | // Get current labels and filter out old CMS labels and labels without ids |
| 789 | const currentLabels = pullRequest.labels |
| 790 | .filter(l => !isCMSLabel(l.name, this.cmsLabelPrefix)) |
| 791 | .filter(l => typeof l.id === 'number') |
| 792 | .map(l => l.id as number); |
| 793 | |
| 794 | // Add the new status label |
| 795 | await this.updatePullRequestLabels(pullRequest.number, [...currentLabels, label.id]); |
| 796 | } |
| 797 | |
| 798 | async getOpenAuthoringBranches(): Promise<ForgejoBranch[]> { |
| 799 | const branches: ForgejoBranch[] = await this.requestAllPages(`${this.repoURL}/branches`); |
no test coverage detected