Skip to content

prlint: a review label doesn't appear when a PR is approved if there are too many comments #31294

@go-to-k

Description

@go-to-k

Describe the bug

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 in CHANGES_REQUESTED state and communityApproved is also false in the job PR 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.

  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.

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

The pr/needs-maintainer-review label appears when a PR is approved even if there are too many comments or change requests.

Current Behavior

The label doesn't appear when a PR is approved if there are too many comments or change requests.

Reproduction Steps

  • Submit a PR
  • Make more than 30 comments or CHANGES_REQUESTED by a trusted community reviewer
  • Approve by the reviewer

Possible Solution

Use pagination for listReviews in the octokit library.

https://github.com/octokit/octokit.js?tab=readme-ov-file#pagination

before

await this.client.pulls.listReviews(this.prParams);

after

await this.client.paginate(this.client.pulls.listReviews, this.prParams);

Additional Information/Context

PRs that have been unlabelled, probably as a result of this issue.

CDK CLI Version

v2.155.0

Framework Version

No response

Node.js Version

18

OS

Depending on GitHub Actions

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2package/toolsRelated to AWS CDK Tools or CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions