From 1f9f987b4aef2aed8795719827675f0f092b8803 Mon Sep 17 00:00:00 2001 From: Jeongwon Song Date: Sat, 17 Feb 2024 15:24:11 -0500 Subject: [PATCH] check for git authentication Signed-off-by: Jeongwon Song --- pkg/github/githubutil.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/github/githubutil.go b/pkg/github/githubutil.go index 2d72b67a..8d830fd7 100644 --- a/pkg/github/githubutil.go +++ b/pkg/github/githubutil.go @@ -231,7 +231,11 @@ 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 { + gh = nil + } + } + if gh == nil { gh = github.NewClient(&http.Client{}) } return gh.Repositories