You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
346 B
Go
22 lines
346 B
Go
5 years ago
|
package github
|
||
|
|
||
|
import (
|
||
|
"hugobot/config"
|
||
|
"context"
|
||
|
|
||
|
"github.com/google/go-github/github"
|
||
|
"golang.org/x/oauth2"
|
||
|
)
|
||
|
|
||
|
func Auth(ctx context.Context) *github.Client {
|
||
|
|
||
|
ts := oauth2.StaticTokenSource(
|
||
|
&oauth2.Token{AccessToken: config.C.GithubAccessToken},
|
||
|
)
|
||
|
|
||
|
tc := oauth2.NewClient(ctx, ts)
|
||
|
client := github.NewClient(tc)
|
||
|
|
||
|
return client
|
||
|
}
|