(
state: 'open' | 'closed' | 'all' = 'open',
head?: string,
)
| 572 | } |
| 573 | |
| 574 | async getPullRequests( |
| 575 | state: 'open' | 'closed' | 'all' = 'open', |
| 576 | head?: string, |
| 577 | ): Promise<ForgejoPullRequest[]> { |
| 578 | const pullRequests = await this.requestAllPages<ForgejoPullRequest>( |
| 579 | `${this.originRepoURL}/pulls`, |
| 580 | { |
| 581 | params: { state, base: this.branch, limit: 100 }, |
| 582 | }, |
| 583 | ); |
| 584 | if (!head) { |
| 585 | return pullRequests; |
| 586 | } |
| 587 | |
| 588 | return pullRequests.filter(pr => { |
| 589 | const label = pr.head?.label; |
| 590 | if (label) { |
| 591 | return label === head; |
| 592 | } |
| 593 | const repoOwner = pr.head?.repo?.owner?.login; |
| 594 | const ref = pr.head?.ref; |
| 595 | if (repoOwner && ref) { |
| 596 | return `${repoOwner}:${ref}` === head; |
| 597 | } |
| 598 | return false; |
| 599 | }); |
| 600 | } |
| 601 | |
| 602 | async getOpenAuthoringPullRequest( |
| 603 | branch: string, |
no test coverage detected