Skip to content

Commit

Permalink
Fix: Check for git authentication when GITHUB_TOKEN exists (flyteorg#463
Browse files Browse the repository at this point in the history
)

Signed-off-by: Jeongwon Song <[email protected]>
  • Loading branch information
jsong336 authored and robert-ulbrich-mercedes-benz committed Jul 2, 2024
1 parent 5398ecc commit e93bffc
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 e93bffc

Please sign in to comment.