(
head: string | undefined,
state: PullRequestState,
predicate: (pr: GitHubPull) => boolean,
)
| 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 |
no test coverage detected