ci: check more reviews in retest action

It seems PullRequests.ListReviews() returns 30 reviews by default. This
is practical for pagination, but not so much for a GitHub action. There
is the rare occasion that the number of reviews if higher than 30. If
that is the case, the retest action does not capture the latest reviews,
which is where the APPROVED status is set.

By increasing the number of results to 100 per page, we should have
sufficient space for many more reviews and automated retest-ing.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
This commit is contained in:
Niels de Vos 2022-06-03 14:39:14 +02:00 committed by mergify[bot]
parent 1952a9b4b3
commit e8c0e75e04

View File

@ -198,7 +198,8 @@ func main() {
// checkPRRequiredApproval check PullRequest has required approvals.
func (c *retestConfig) checkPRRequiredApproval(prNumber int) bool {
rev, _, err := c.client.PullRequests.ListReviews(context.TODO(), c.owner, c.repo, prNumber, &github.ListOptions{})
opts := github.ListOptions{PerPage: 100} // defaults to 30 reviews, too few sometimes
rev, _, err := c.client.PullRequests.ListReviews(context.TODO(), c.owner, c.repo, prNumber, &opts)
if err != nil {
log.Printf("failed to list reviews %v\n", err)
return false