diff --git a/applicationset/services/pull_request/github.go b/applicationset/services/pull_request/github.go index a69f5a967c6da..861dd68e87502 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 489940ad2b083..bf33b16d4e8ee 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)