From c20ac5ba62ad68077f1b055a215f409d95e81aab Mon Sep 17 00:00:00 2001 From: steeeve Date: Wed, 21 Sep 2022 18:12:49 -0400 Subject: [PATCH] Fix improper github org member pagination I'm not sure I fully understand why this issue exists. But I think the short version is this: When we attempted to paginate users, we would set a variable's Page value. But that variable appears to not actually be a pointer, despite being added as one. It probably has to do with how struct embedding works. Either way, if we make the overall options variable the whole thing, and update its embedded struct with our page variable, everything works out. --- pkg/sources/github/github.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/sources/github/github.go b/pkg/sources/github/github.go index 62d5ed045fa7..9c74730f4732 100644 --- a/pkg/sources/github/github.go +++ b/pkg/sources/github/github.go @@ -788,16 +788,15 @@ func (s *Source) addOrgsByUser(ctx context.Context, user string) { } func (s *Source) addMembersByOrg(ctx context.Context, org string) error { - opts := &github.ListOptions{ - PerPage: membersAppPagination, - } - optsOrg := &github.ListMembersOptions{ - PublicOnly: false, - ListOptions: *opts, + opts := &github.ListMembersOptions{ + PublicOnly: false, + ListOptions: github.ListOptions{ + PerPage: membersAppPagination, + }, } for { - members, res, err := s.apiClient.Organizations.ListMembers(ctx, org, optsOrg) + members, res, err := s.apiClient.Organizations.ListMembers(ctx, org, opts) if err == nil { defer res.Body.Close() }