2017-01-14 14:50:46 -02:00
|
|
|
package clients
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/google/go-github/github"
|
2017-02-23 16:01:54 -03:00
|
|
|
"github.com/goreleaser/goreleaser/context"
|
2017-01-14 14:50:46 -02:00
|
|
|
"golang.org/x/oauth2"
|
|
|
|
)
|
|
|
|
|
2017-01-15 08:49:49 -02:00
|
|
|
// GitHub client for the given token
|
2017-02-23 16:01:54 -03:00
|
|
|
func GitHub(ctx *context.Context) *github.Client {
|
2017-01-14 14:50:46 -02:00
|
|
|
ts := oauth2.StaticTokenSource(
|
2017-02-23 16:01:54 -03:00
|
|
|
&oauth2.Token{AccessToken: ctx.Token},
|
2017-01-14 14:50:46 -02:00
|
|
|
)
|
2017-02-23 16:01:54 -03:00
|
|
|
return github.NewClient(oauth2.NewClient(ctx, ts))
|
2017-01-14 14:50:46 -02:00
|
|
|
}
|