Skip to content

Commit

Permalink
🐛 Fix failures in GitHub pagination when fetching org repos (#1183)
Browse files Browse the repository at this point in the history
We were passing in a new repo options data structure each time that set
the pagination back to the initial value.

Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored May 9, 2023
1 parent 12ff032 commit 5e7aee4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions motor/discovery/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ func (r *Resolver) Resolve(ctx context.Context, root *asset.Asset, pCfg *provide
return nil, err
}

listOpts := &github.RepositoryListByOrgOptions{
listOpts := &github.RepositoryListOptions{
ListOptions: github.ListOptions{PerPage: 100},
Type: "all",
}
allRepos := []*github.Repository{}
for {
repos, resp, err := p.Client().Repositories.List(context.Background(), org.GetLogin(), &github.RepositoryListOptions{})
repos, resp, err := p.Client().Repositories.List(context.Background(), org.GetLogin(), listOpts)
if err != nil {
if strings.Contains(err.Error(), "404") {
return nil, nil
Expand Down

0 comments on commit 5e7aee4

Please sign in to comment.