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

feat: support skip tls on github cli

This commit is contained in:
Carlos Alexandro Becker
2019-01-17 11:25:57 -02:00
committed by Carlos Alexandro Becker
parent 742c8d03aa
commit e13a3319bb
2 changed files with 13 additions and 4 deletions

View File

@ -2,6 +2,8 @@ package client
import (
"bytes"
"crypto/tls"
"net/http"
"net/url"
"os"
@ -22,7 +24,13 @@ func NewGitHub(ctx *context.Context) (Client, error) {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: ctx.Token},
)
client := github.NewClient(oauth2.NewClient(ctx, ts))
httpClient := oauth2.NewClient(ctx, ts)
if ctx.Config.GitHubURLs.SkipTLSVerify {
httpClient.Transport.(*http.Transport).TLSClientConfig = &tls.Config{
InsecureSkipVerify: ctx.Config.GitHubURLs.SkipTLSVerify,
}
}
client := github.NewClient(httpClient)
if ctx.Config.GitHubURLs.API != "" {
api, err := url.Parse(ctx.Config.GitHubURLs.API)
if err != nil {