(
head: string | undefined,
state: PullRequestState,
predicate: (pr: GitHubPull) => boolean,
)
| 548 | } |
| 549 | |
| 550 | async getPullRequests( |
| 551 | head: string | undefined, |
| 552 | state: PullRequestState, |
| 553 | predicate: (pr: GitHubPull) => boolean, |
| 554 | ) { |
| 555 | const pullRequests: Endpoints['GET /repos/{owner}/{repo}/pulls']['response']['data'] = |
| 556 | await this.requestAllPages(`${this.originRepoURL}/pulls`, { |
| 557 | params: { |
| 558 | ...(head ? { head: await this.getHeadReference(head) } : {}), |
| 559 | base: this.branch, |
| 560 | state, |
| 561 | per_page: 100, |
| 562 | }, |
| 563 | }); |
| 564 | |
| 565 | return pullRequests.filter( |
| 566 | pr => pr.head.ref.startsWith(`${CMS_BRANCH_PREFIX}/`) && predicate(pr), |
| 567 | ); |
| 568 | } |
| 569 | |
| 570 | async getOpenAuthoringPullRequest(branch: string, pullRequests: GitHubPull[]) { |
| 571 | // we can't use labels when using open authoring |
no test coverage detected