Skip to content

Commit

Permalink
add affiliation
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Jan 1, 2018
1 parent e9ac53c commit 654249b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,19 @@ func main() {

page := 1
perPage := 100
affiliation := "owner,collaborator"
if len(orgs) > 0 {
affiliation += ",organization_member"
}
logrus.Debugf("Getting repositories...")
if err := getRepositories(ctx, client, page, perPage); err != nil {
if err := getRepositories(ctx, client, page, perPage, affiliation); err != nil {
logrus.Fatal(err)
}
}

func getRepositories(ctx context.Context, client *github.Client, page, perPage int) error {
func getRepositories(ctx context.Context, client *github.Client, page, perPage int, affiliation string) error {
opt := &github.RepositoryListOptions{
Affiliation: affiliation,
ListOptions: github.ListOptions{
Page: page,
PerPage: perPage,
Expand All @@ -182,7 +187,7 @@ func getRepositories(ctx context.Context, client *github.Client, page, perPage i
}

page = resp.NextPage
return getRepositories(ctx, client, page, perPage)
return getRepositories(ctx, client, page, perPage, affiliation)
}

// handleRepo will return nil error if the user does not have access to something.
Expand Down

0 comments on commit 654249b

Please sign in to comment.