(sourceBranch?: string)
| 673 | }; |
| 674 | |
| 675 | async getPullRequests(sourceBranch?: string) { |
| 676 | const sourceQuery = sourceBranch |
| 677 | ? `source.branch.name = "${sourceBranch}"` |
| 678 | : `source.branch.name ~ "${CMS_BRANCH_PREFIX}/"`; |
| 679 | |
| 680 | const pullRequests: BitBucketPullRequests = await this.requestJSON({ |
| 681 | url: `${this.repoURL}/pullrequests`, |
| 682 | params: { |
| 683 | pagelen: 50, |
| 684 | q: oneLine` |
| 685 | source.repository.full_name = "${this.repo}" |
| 686 | AND state = "${BitBucketPullRequestState.OPEN}" |
| 687 | AND destination.branch.name = "${this.branch}" |
| 688 | AND comment_count > 0 |
| 689 | AND ${sourceQuery} |
| 690 | `, |
| 691 | }, |
| 692 | }); |
| 693 | |
| 694 | const labels = await Promise.all( |
| 695 | pullRequests.values.map(pr => this.getPullRequestLabel(pr.id)), |
| 696 | ); |
| 697 | |
| 698 | return pullRequests.values.filter((_, index) => isCMSLabel(labels[index], this.cmsLabelPrefix)); |
| 699 | } |
| 700 | |
| 701 | async getBranchPullRequest(branch: string) { |
| 702 | const pullRequests = await this.getPullRequests(branch); |
no test coverage detected