Skip to content

Commit

Permalink
oauth token is optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Kostov6 committed Nov 22, 2021
1 parent 4044eb9 commit 6552783
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/app/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func gatherCredentials(flags *cmdFlags, config *configuration.Config) []*Credent
}
}

if len(flags.ghOAuthToken) > 0 {
if len(flags.ghOAuthToken) >= 0 {
var username string
token := flags.ghOAuthToken
if _, ok := credentialsByHost["github.com"]; ok {
Expand Down
6 changes: 5 additions & 1 deletion cmd/app/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ func buildClient(ctx context.Context, accessToken string, withClientThrottling b

var client *github.Client
if host == "https://github.com" {
client = github.NewClient(oauthClient)
if accessToken != "" {
client = github.NewClient(oauthClient)
} else {
client = github.NewClient(nil)
}
return client, oauthClient, nil
}
client, err = github.NewEnterpriseClient(host, "", oauthClient)
Expand Down

0 comments on commit 6552783

Please sign in to comment.