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

Method getPullRequests

packages/decap-cms-backend-github/src/API.ts:525–543  ·  view source on GitHub ↗
(
    head: string | undefined,
    state: PullRequestState,
    predicate: (pr: GitHubPull) => boolean,
  )

Source from the content-addressed store, hash-verified

523 }
524
525 async getPullRequests(
526 head: string | undefined,
527 state: PullRequestState,
528 predicate: (pr: GitHubPull) => boolean,
529 ) {
530 const pullRequests: Endpoints['GET /repos/{owner}/{repo}/pulls']['response']['data'] =
531 await this.requestAllPages(`${this.originRepoURL}/pulls`, {
532 params: {
533 ...(head ? { head: await this.getHeadReference(head) } : {}),
534 base: this.branch,
535 state,
536 per_page: 100,
537 },
538 });
539
540 return pullRequests.filter(
541 pr => pr.head.ref.startsWith(`${CMS_BRANCH_PREFIX}/`) && predicate(pr),
542 );
543 }
544
545 async getOpenAuthoringPullRequest(branch: string, pullRequests: GitHubPull[]) {
546 // we can't use labels when using open authoring

Callers 3

getBranchPullRequestMethod · 0.95
migrateToVersion1Method · 0.95

Calls 3

requestAllPagesMethod · 0.95
getHeadReferenceMethod · 0.95
filterMethod · 0.80

Tested by

no test coverage detected