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