diff --git a/applicationset/services/pull_request/github.go b/applicationset/services/pull_request/github.go index 2340ed3f444a4..dd63a68105552 100644 --- a/applicationset/services/pull_request/github.go +++ b/applicationset/services/pull_request/github.go @@ -26,7 +26,11 @@ func NewGithubService(token, url, owner, repo string, labels []string) (PullRequ httpClient := &http.Client{} var client *github.Client if url == "" { - client = github.NewClient(httpClient).WithAuthToken(token) + if token == "" { + client = github.NewClient(httpClient) + } else { + client = github.NewClient(httpClient).WithAuthToken(token) + } } else { var err error client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url) diff --git a/applicationset/services/scm_provider/github.go b/applicationset/services/scm_provider/github.go index ac1c49010f384..41680b0145269 100644 --- a/applicationset/services/scm_provider/github.go +++ b/applicationset/services/scm_provider/github.go @@ -25,7 +25,11 @@ func NewGithubProvider(organization string, token string, url string, allBranche httpClient := &http.Client{} var client *github.Client if url == "" { - client = github.NewClient(httpClient).WithAuthToken(token) + if token == "" { + client = github.NewClient(httpClient) + } else { + client = github.NewClient(httpClient).WithAuthToken(token) + } } else { var err error client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)