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

Method setPullRequestStatus

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

Source from the content-addressed store, hash-verified

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

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