Skip to content

Commit

Permalink
chore(prlint): linter comments every minute on PRs that have many com…
Browse files Browse the repository at this point in the history
…ments (#32671)

Fixes things like this #32503. I don't believe this is testable given that we mock the paginate function in our tests to begin with. But it follows the same path as #31290 that hasn't caused problems.

### 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
kaizencc authored Dec 27, 2024
1 parent 3d1d81a commit c2bd634
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/@aws-cdk/prlint/lint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,8 +265,8 @@ export class PullRequestLinter {
});
}

const comments = await this.client.issues.listComments(this.issueParams);
if (comments.data.find(comment => comment.body?.toLowerCase().includes("exemption request"))) {
const comments = await this.client.paginate(this.client.issues.listComments, this.issueParams);
if (comments.find(comment => comment.body?.toLowerCase().includes("exemption request"))) {
body += '\n\n✅ A exemption request has been requested. Please wait for a maintainer\'s review.';
}
await this.client.issues.createComment({
Expand Down Expand Up @@ -303,17 +303,17 @@ export class PullRequestLinter {
* @returns Existing review, if present
*/
private async findExistingPRLinterReview(): Promise<Review | undefined> {
const reviews = await this.client.pulls.listReviews(this.prParams);
return reviews.data.find((review) => review.user?.login === 'aws-cdk-automation' && review.state !== 'DISMISSED') as Review;
const reviews = await this.client.paginate(this.client.pulls.listReviews, this.prParams);
return reviews.find((review) => review.user?.login === 'aws-cdk-automation' && review.state !== 'DISMISSED') as Review;
}

/**
* Finds existing comment from previous review, if present
* @returns Existing comment, if present
*/
private async findExistingPRLinterComment(): Promise<Comment | undefined> {
const comments = await this.client.issues.listComments(this.issueParams);
return comments.data.find((comment) => comment.user?.login === 'aws-cdk-automation' && comment.body?.startsWith('The pull request linter fails with the following errors:')) as Comment;
const comments = await this.client.paginate(this.client.issues.listComments, this.issueParams);
return comments.find((comment) => comment.user?.login === 'aws-cdk-automation' && comment.body?.startsWith('The pull request linter fails with the following errors:')) as Comment;
}

/**
Expand Down

0 comments on commit c2bd634

Please sign in to comment.