1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-07-05 00:59:04 +02:00

feat: support custom tokens in Homebrew & Scoop (#1650)

This commit is contained in:
Radek Simko
2020-07-06 21:12:41 +01:00
committed by GitHub
parent 0d4f605388
commit ab8bb7f2f3
18 changed files with 258 additions and 75 deletions

View File

@ -25,9 +25,9 @@ type githubClient struct {
}
// NewGitHub returns a github client implementation.
func NewGitHub(ctx *context.Context) (Client, error) {
func NewGitHub(ctx *context.Context, token string) (Client, error) {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: ctx.Token},
&oauth2.Token{AccessToken: token},
)
httpClient := oauth2.NewClient(ctx, ts)
base := httpClient.Transport.(*oauth2.Transport).Base
@ -59,7 +59,7 @@ func NewGitHub(ctx *context.Context) (Client, error) {
func (c *githubClient) CreateFile(
ctx *context.Context,
commitAuthor config.CommitAuthor,
repo config.Repo,
repo Repo,
content []byte,
path,
message string,