From 279f421a08322d3fdb162b6001f333601bfb552c Mon Sep 17 00:00:00 2001 From: Jack Stockley Date: Wed, 8 Mar 2023 08:12:45 +0000 Subject: [PATCH] fix(client): update client --- github-api/client/client.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/github-api/client/client.go b/github-api/client/client.go index c235855..750a43b 100644 --- a/github-api/client/client.go +++ b/github-api/client/client.go @@ -2,7 +2,6 @@ package client import ( "context" - "log" "github.com/google/go-github/github" "golang.org/x/oauth2" @@ -10,17 +9,17 @@ import ( // 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 }