Skip to content

Commit b9b48ca

Browse files
author
Scott Schulthess
committed
invert condition
1 parent 391d60f commit b9b48ca

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

github.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ func NewGithubClient(s *Source) (*GithubClient, error) {
6262
}
6363

6464
var client *http.Client
65-
if s.UseGitHubApp {
65+
if !s.UseGitHubApp {
66+
// Client using oauth2 wrapper
67+
client = oauth2.NewClient(ctx, oauth2.StaticTokenSource(
68+
&oauth2.Token{AccessToken: s.AccessToken},
69+
))
70+
} else {
6671
var ghAppInstallationTransport *ghinstallation.Transport
6772
ghAppInstallationTransport, err = ghinstallation.New(transport, s.ApplicationID, s.InstallationID, []byte(s.PrivateKey))
6873
if err != nil {
@@ -73,11 +78,6 @@ func NewGithubClient(s *Source) (*GithubClient, error) {
7378
client = &http.Client{
7479
Transport: ghAppInstallationTransport,
7580
}
76-
} else {
77-
// Client using oauth2 wrapper
78-
client = oauth2.NewClient(ctx, oauth2.StaticTokenSource(
79-
&oauth2.Token{AccessToken: s.AccessToken},
80-
))
8181
}
8282

8383
var v3 *github.Client

0 commit comments

Comments
 (0)