Skip to content

Commit

Permalink
Fix: Check for git authentication when GITHUB_TOKEN exists (#463)
Browse files Browse the repository at this point in the history
Signed-off-by: Jeongwon Song <[email protected]>
  • Loading branch information
jsong336 authored Feb 20, 2024
1 parent cff5a3d commit 8362431
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion flytectl/pkg/github/githubutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,12 @@ func GetGHRepoService() GHRepoService {
gh = github.NewClient(oauth2.NewClient(context.Background(), oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
)))
} else {
if _, err := ListReleases(flyte, gh.Repositories); err != nil {
logger.Warnf(context.Background(), "Found GITHUB_TOKEN but failed to fetch releases. Using empty http.Client: %s.", err)
gh = nil
}
}
if gh == nil {
gh = github.NewClient(&http.Client{})
}
return gh.Repositories
Expand Down

0 comments on commit 8362431

Please sign in to comment.