Skip to content

Commit d9384f5

Browse files
authored
Merge pull request kubernetes#2351 from johnbelamaric/fix-pr-pagination
Page through all PRs
2 parents 8cac891 + f67ed46 commit d9384f5

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pkg/kepctl/kepctl.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,13 +237,22 @@ func (c *Client) loadKEPPullRequests(sig string) ([]*keps.Proposal, error) {
237237
}
238238

239239
gh := github.NewClient(auth)
240-
pulls, _, err := gh.PullRequests.List(ctx, "kubernetes", "enhancements", &github.PullRequestListOptions{})
241-
if err != nil {
242-
return nil, err
240+
allPulls := []*github.PullRequest{}
241+
opt := &github.PullRequestListOptions{ListOptions: github.ListOptions{PerPage: 100}}
242+
for {
243+
pulls, resp, err := gh.PullRequests.List(ctx, "kubernetes", "enhancements", opt)
244+
if err != nil {
245+
return nil, err
246+
}
247+
allPulls = append(allPulls, pulls...)
248+
if resp.NextPage == 0 {
249+
break
250+
}
251+
opt.Page = resp.NextPage
243252
}
244253

245254
var kepPRs []*github.PullRequest
246-
for _, pr := range pulls {
255+
for _, pr := range allPulls {
247256
foundKind, foundSIG := false, false
248257
sigLabel := strings.Replace(sig, "-", "/", 1)
249258
for _, l := range pr.Labels {

0 commit comments

Comments
 (0)