-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(prlint): a review label doesn't appear when a PR is approved if there are too many comments #31290
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
@@ -373,17 +373,17 @@ export class PullRequestLinter { | |||
private async assessNeedsReview( | |||
pr: Pick<GitHubPr, 'mergeable_state' | 'draft' | 'labels' | 'number'>, | |||
): 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @go-to-k!
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-review
label. It seems to be inCHANGES_REQUESTED
state andcommunityApproved
is 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