1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-26 04:22:05 +02:00
goreleaser/clients/github.go

16 lines
353 B
Go
Raw Normal View History

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"
)
// 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
}