diff --git a/flytectl/pkg/github/githubutil.go b/flytectl/pkg/github/githubutil.go index 2d72b67af7..680085370b 100644 --- a/flytectl/pkg/github/githubutil.go +++ b/flytectl/pkg/github/githubutil.go @@ -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