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

Method getPullRequests

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

Source from the content-addressed store, hash-verified

551 }
552
553 async getPullRequests(
554 head: string | undefined,
555 state: PullRequestState,
556 predicate: (pr: GitHubPull) => boolean,
557 ) {
558 const pullRequests: Endpoints['GET /repos/{owner}/{repo}/pulls']['response']['data'] =
559 await this.requestAllPages(`${this.originRepoURL}/pulls`, {
560 params: {
561 ...(head ? { head: await this.getHeadReference(head) } : {}),
562 base: this.branch,
563 state,
564 per_page: 100,
565 },
566 });
567
568 return pullRequests.filter(
569 pr => pr.head.ref.startsWith(`${CMS_BRANCH_PREFIX}/`) && predicate(pr),
570 );
571 }
572
573 async getOpenAuthoringPullRequest(branch: string, pullRequests: GitHubPull[]) {
574 // 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