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