Skip to content

Commit

Permalink
fix(client): update client
Browse files Browse the repository at this point in the history
  • Loading branch information
jackstockley89 committed Mar 8, 2023
1 parent a7a6be5 commit 279f421
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions github-api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,24 @@ package client

import (
"context"
"log"

"github.com/google/go-github/github"
"golang.org/x/oauth2"
)

// clientConnect Takens a token and uses this to establish a connection to github
func ClientConnect(token string) *github.Client {

var client *github.Client
// get env token
// Connect to giithub
if token == "" {
log.Fatal("token missing")
}
ctx := context.Background()
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
)
tc := oauth2.NewClient(ctx, ts)
client := github.NewClient(tc)
client = github.NewClient(tc)
if token == "" {
client = github.NewClient(nil)
}
return client
}

0 comments on commit 279f421

Please sign in to comment.