diff --git a/cli/cli/helpers/github_auth_config/oauth.go b/cli/cli/helpers/github_auth_config/oauth.go index 4c2be28d14..8477398631 100644 --- a/cli/cli/helpers/github_auth_config/oauth.go +++ b/cli/cli/helpers/github_auth_config/oauth.go @@ -31,6 +31,10 @@ var ( browser = *gitbrowser.New(defaultLauncher, os.Stdout, os.Stderr) ) +type OAuthFlow interface { + AuthFlow() (string, string, error) +} + func AuthFlow() (string, string, error) { httpClient := &http.Client{} // nolint: exhaustruct diff --git a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go index b22e03bbc3..a3cf9e0cfc 100644 --- a/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go +++ b/core/server/api_container/server/startosis_engine/startosis_packages/git_package_content_provider/git_package_content_provider.go @@ -16,6 +16,7 @@ import ( "github.com/mholt/archiver" "github.com/sirupsen/logrus" "io" + "io/fs" "os" "path" "strings" @@ -424,10 +425,13 @@ func (provider *GitPackageContentProvider) atomicClone(parsedURL *shared_utils.P return nil } -// Returns empty string if no token found in [githubAuthTokenFile] +// Returns empty string if no token found in [githubAuthTokenFile] or [githubAuthTokenFile] doesn't exist func (provider *GitPackageContentProvider) getGitHubAuthToken() (string, error) { tokenBytes, err := os.ReadFile(provider.githubAuthTokenFile) if err != nil { + if errors.Is(err, fs.ErrNotExist) { + return "", nil + } return "", stacktrace.Propagate(err, "An error occurred reading contents at '%v' to retrieve GitHub auth token.", provider.githubAuthTokenFile) } return string(tokenBytes), nil