Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(prlint): a review label doesn't appear when a PR is approved if t…
…here are too many comments (#31290) ### Issue # (if applicable) Closes #31294 . ### Reason for this change I've reviewed and approved [this PR](#30920) as a Trusted Community Reviewer. But it doesn't get the `pr/needs-maintainer-review` label. It seems to be in `CHANGES_REQUESTED` state and `communityApproved` is also false in the job `PR Linter / validate-pr`. (Please see [this comment in the PR](#30920 (comment)).) I checked [the prlint's log](https://github.com/aws/aws-cdk/blob/main/tools/@aws-cdk/prlint/lint.ts#L377) in [the GitHub Actions output](https://github.com/aws/aws-cdk/actions/runs/10669155243/job/29570426536), and it appears that there is too much history (such as comments) to get all the latest data. [List reviews for a pull request](https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#list-reviews-for-a-pull-request) in GitHub API can get 30 items per page, however, [prlint is not implemented to handle pagination](https://github.com/aws/aws-cdk/blob/main/tools/%40aws-cdk/prlint/lint.ts#L376). ```ts private async assessNeedsReview( pr: Pick<GitHubPr, 'mergeable_state' | 'draft' | 'labels' | 'number'>, ): Promise<void> { const reviews = await this.client.pulls.listReviews(this.prParams); ``` Therefore, when there are **more than 30 comments or change requests**, the review label is no longer displayed. ### Description of changes Use pagination for listReviews in the octokit library. https://github.com/octokit/octokit.js?tab=readme-ov-file#pagination before ```ts await this.client.pulls.listReviews(this.prParams); ``` after ```ts await this.client.paginate(this.client.pulls.listReviews, this.prParams); ``` ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information