fix(prlint): a review label doesn't appear when a PR is approved if there are too many comments#31290
Conversation
aws-cdk-automation
left a comment
There was a problem hiding this comment.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.
|
Exemption Request: This PR only changes the call handling regarding the external API (GitHub API via octokit), and the handling is mocked in unit tests. So I can't test in the unit tests. The no regression is confirmed by the fact that existing tests pass. https://github.com/aws/aws-cdk/blob/v2.155.0/tools/%40aws-cdk/prlint/test/lint.test.ts#L7-L9 https://github.com/aws/aws-cdk/blob/v2.155.0/tools/%40aws-cdk/prlint/test/lint.test.ts#L1207 It also appears that a PR that have introduced pagination in prlint in the past have not added testing in the same way. |
| ): Promise<void> { | ||
| const reviews = await this.client.pulls.listReviews(this.prParams); | ||
| console.log(JSON.stringify(reviews.data)); | ||
| const reviewsData = await this.client.paginate(this.client.pulls.listReviews, this.prParams); |
There was a problem hiding this comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
Closes #31294 .
Reason for this change
I've reviewed and approved this PR as a Trusted Community Reviewer.
But it doesn't get the
pr/needs-maintainer-reviewlabel. It seems to be inCHANGES_REQUESTEDstate andcommunityApprovedis also false in the jobPR Linter / validate-pr. (Please see this comment in the PR.)I checked the prlint's log in the GitHub Actions output, and it appears that there is too much history (such as comments) to get all the latest data.
List reviews for a pull request in GitHub API can get 30 items per page, however, prlint is not implemented to handle pagination.
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
after
Description of how you validated changes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license