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

Method setPullRequestStatus

packages/decap-cms-backend-forgejo/src/API.ts:763–789  ·  view source on GitHub ↗
(pullRequest: ForgejoPullRequest, status: string)

Source from the content-addressed store, hash-verified

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`);

Callers 3

editorialWorkflowGitMethod · 0.95
API.spec.jsFile · 0.45

Calls 6

getOrCreateLabelMethod · 0.95
statusToLabelFunction · 0.90
isCMSLabelFunction · 0.90
mapMethod · 0.80
filterMethod · 0.80

Tested by

no test coverage detected