Skip to content

Commit

Permalink
fix: allow unauthenticated (#96)
Browse files Browse the repository at this point in the history
* fix: use unauthenticated client if no token provided

* docs: add note about rate limits
  • Loading branch information
6d7a authored Jul 27, 2023
1 parent 5d25ac1 commit 3be1230
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ func newClient(ctx context.Context, token, baseURL string) (*github.Client, erro
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})

if baseURL == "" {
return github.NewClient(oauth2.NewClient(ctx, ts)), nil
if token == "" {
return github.NewClient(nil), nil
} else {
return github.NewClient(oauth2.NewClient(ctx, ts)), nil
}
}

return github.NewEnterpriseClient(baseURL, "", oauth2.NewClient(ctx, ts))
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Finally, it prints a rank by each category.
Important notes:
* GitHub's API rate limits for unauthenticated requests have been lowered significantly in the recent past. Using the ` + "`--token`" + ` option for compiling stats will speed up gathering of data considerably, since for authenticated requests it will be less likely that rate-limiting timelocks have to be awaited.
* The ` + "`--since`" + ` filter does not work "that well" because GitHub summarizes thedata by week, so the data is not as granular as it should be.
* The ` + "`--include-reviews`" + ` only grabs reviews from users that had contributions on the previous step.
* In the ` + "`--blacklist`" + ` option, 'foo' blacklists both the 'foo' user and 'foo' repo, while 'user:foo' blacklists only the user and 'repo:foo' only the repository.
Expand Down

0 comments on commit 3be1230

Please sign in to comment.