fix: funlen
Signed-off-by: jolheiser <john.olheiser@gmail.com>
This commit is contained in:
parent
383ca9cd30
commit
85b044ae07
|
@ -28,16 +28,7 @@ type GitHub struct {
|
|||
func (gh *GitHub) Generate() (string, []Entry, error) {
|
||||
tagURL := fmt.Sprintf("## [%s](https://github.com/%s/releases/tag/%s) - %s", gh.Milestone, gh.Repo, gh.GitTag, time.Now().Format("2006-01-02"))
|
||||
|
||||
cl := http.DefaultClient
|
||||
if token, ok := os.LookupEnv("CHANGELOG_GITHUB_TOKEN"); ok {
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: token},
|
||||
)
|
||||
cl = oauth2.NewClient(ctx, ts)
|
||||
}
|
||||
|
||||
client := github.NewClient(cl)
|
||||
client := github.NewClient(httpClient())
|
||||
ctx := context.Background()
|
||||
|
||||
prs := make([]Entry, 0)
|
||||
|
@ -93,16 +84,7 @@ func (gh *GitHub) Generate() (string, []Entry, error) {
|
|||
|
||||
// Contributors returns a list of contributors from GitHub
|
||||
func (gh *GitHub) Contributors() (ContributorList, error) {
|
||||
cl := http.DefaultClient
|
||||
if token, ok := os.LookupEnv("CHANGELOG_GITHUB_TOKEN"); ok {
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: token},
|
||||
)
|
||||
cl = oauth2.NewClient(ctx, ts)
|
||||
}
|
||||
|
||||
client := github.NewClient(cl)
|
||||
client := github.NewClient(httpClient())
|
||||
ctx := context.Background()
|
||||
|
||||
contributorsMap := make(map[string]bool)
|
||||
|
@ -140,3 +122,15 @@ func (gh *GitHub) Contributors() (ContributorList, error) {
|
|||
|
||||
return contributors, nil
|
||||
}
|
||||
|
||||
func httpClient() *http.Client {
|
||||
cl := http.DefaultClient
|
||||
if token, ok := os.LookupEnv("CHANGELOG_GITHUB_TOKEN"); ok {
|
||||
ctx := context.Background()
|
||||
ts := oauth2.StaticTokenSource(
|
||||
&oauth2.Token{AccessToken: token},
|
||||
)
|
||||
cl = oauth2.NewClient(ctx, ts)
|
||||
}
|
||||
return cl
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue