Skip to content

Commit f7590fa

Browse files
lets-call-n-walkCollin Walker
andauthored
fix(appset): Add token to enterprise client (#23240) (#23455)
Signed-off-by: Collin Walker <[email protected]> Co-authored-by: Collin Walker <[email protected]>
1 parent 8ede222 commit f7590fa

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

applicationset/services/pull_request/github.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ func NewGithubService(token, url, owner, repo string, labels []string, optionalH
3737
}
3838
} else {
3939
var err error
40-
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
40+
if token == "" {
41+
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
42+
} else {
43+
client, err = github.NewClient(httpClient).WithAuthToken(token).WithEnterpriseURLs(url, url)
44+
}
4145
if err != nil {
4246
return nil, err
4347
}

applicationset/services/scm_provider/github.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ func NewGithubProvider(organization string, token string, url string, allBranche
3636
}
3737
} else {
3838
var err error
39-
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
39+
if token == "" {
40+
client, err = github.NewClient(httpClient).WithEnterpriseURLs(url, url)
41+
} else {
42+
client, err = github.NewClient(httpClient).WithAuthToken(token).WithEnterpriseURLs(url, url)
43+
}
4044
if err != nil {
4145
return nil, err
4246
}

0 commit comments

Comments
 (0)