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

Method getPullRequests

packages/decap-cms-backend-forgejo/src/API.ts:574–600  ·  view source on GitHub ↗
(
    state: 'open' | 'closed' | 'all' = 'open',
    head?: string,
  )

Source from the content-addressed store, hash-verified

572 }
573
574 async getPullRequests(
575 state: 'open' | 'closed' | 'all' = 'open',
576 head?: string,
577 ): Promise<ForgejoPullRequest[]> {
578 const pullRequests = await this.requestAllPages<ForgejoPullRequest>(
579 `${this.originRepoURL}/pulls`,
580 {
581 params: { state, base: this.branch, limit: 100 },
582 },
583 );
584 if (!head) {
585 return pullRequests;
586 }
587
588 return pullRequests.filter(pr => {
589 const label = pr.head?.label;
590 if (label) {
591 return label === head;
592 }
593 const repoOwner = pr.head?.repo?.owner?.login;
594 const ref = pr.head?.ref;
595 if (repoOwner && ref) {
596 return `${repoOwner}:${ref}` === head;
597 }
598 return false;
599 });
600 }
601
602 async getOpenAuthoringPullRequest(
603 branch: string,

Callers 4

getBranchPullRequestMethod · 0.95
API.spec.jsFile · 0.45

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected