From ae6814466ede9c5ca7f162cea985ce0e92dcf2c3 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Thu, 14 Oct 2021 09:32:52 -0300 Subject: [PATCH] feat(deps): upgrade go-github (#2581) Signed-off-by: Carlos A Becker --- go.mod | 4 ++-- go.sum | 7 ++++--- internal/client/github.go | 34 ++++++++++++++++++++++------------ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/go.mod b/go.mod index 9c43914f4..52641ff94 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/dghubble/go-twitter v0.0.0-20210609183100-2fdbf421508e github.com/dghubble/oauth1 v0.7.0 github.com/fatih/color v1.12.0 - github.com/google/go-github/v35 v35.3.0 + github.com/google/go-github/v39 v39.2.0 github.com/goreleaser/fileglob v1.2.0 github.com/goreleaser/nfpm/v2 v2.6.0 github.com/imdario/mergo v0.3.12 @@ -70,7 +70,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.6 // indirect - github.com/google/go-querystring v1.0.0 // indirect + github.com/google/go-querystring v1.1.0 // indirect github.com/google/rpmpack v0.0.0-20210410105602-e20c988a6f5a // indirect github.com/google/uuid v1.3.0 // indirect github.com/google/wire v0.5.0 // indirect diff --git a/go.sum b/go.sum index 030b369e2..da8ed1428 100644 --- a/go.sum +++ b/go.sum @@ -361,10 +361,11 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-github/v35 v35.3.0 h1:fU+WBzuukn0VssbayTT+Zo3/ESKX9JYWjbZTLOTEyho= -github.com/google/go-github/v35 v35.3.0/go.mod h1:yWB7uCcVWaUbUP74Aq3whuMySRMatyRmq5U9FTNlbio= -github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= +github.com/google/go-github/v39 v39.2.0 h1:rNNM311XtPOz5rDdsJXAp2o8F67X9FnROXTvto3aSnQ= +github.com/google/go-github/v39 v39.2.0/go.mod h1:C1s8C5aCC9L+JXIYpJM5GYytdX52vC1bLvHEF1IhBrE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= +github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= github.com/google/go-replayers/grpcreplay v1.1.0 h1:S5+I3zYyZ+GQz68OfbURDdt/+cSMqCK1wrvNx7WBzTE= github.com/google/go-replayers/grpcreplay v1.1.0/go.mod h1:qzAvJ8/wi57zq7gWqaE6AwLM6miiXUQwP1S+I9icmhk= github.com/google/go-replayers/httpreplay v1.0.0 h1:8SmT8fUYM4nueF+UnXIX8LJxNTb1vpPuknXz+yTWzL4= diff --git a/internal/client/github.go b/internal/client/github.go index 3160a9972..91c4568ff 100644 --- a/internal/client/github.go +++ b/internal/client/github.go @@ -11,7 +11,7 @@ import ( "strings" "github.com/apex/log" - "github.com/google/go-github/v35/github" + "github.com/google/go-github/v39/github" "github.com/goreleaser/goreleaser/internal/artifact" "github.com/goreleaser/goreleaser/internal/tmpl" "github.com/goreleaser/goreleaser/pkg/config" @@ -59,19 +59,29 @@ func NewGitHub(ctx *context.Context, token string) (Client, error) { } func (c *githubClient) Changelog(ctx *context.Context, repo Repo, prev, current string) (string, error) { - result, _, err := c.client.Repositories.CompareCommits(ctx, repo.Owner, repo.Name, prev, current) - if err != nil { - return "", err - } var log []string - for _, commit := range result.Commits { - log = append(log, fmt.Sprintf( - "%s: %s (@%s)", - commit.GetSHA(), - strings.Split(commit.Commit.GetMessage(), "\n")[0], - commit.GetAuthor().GetLogin(), - )) + + opts := &github.ListOptions{PerPage: 100} + for { + result, resp, err := c.client.Repositories.CompareCommits(ctx, repo.Owner, repo.Name, prev, current, opts) + if err != nil { + return "", err + } + for _, commit := range result.Commits { + log = append(log, fmt.Sprintf( + "%s: %s (@%s)", + commit.GetSHA(), + strings.Split(commit.Commit.GetMessage(), "\n")[0], + commit.GetAuthor().GetLogin(), + )) + } + if resp.NextPage == 0 { + break + } + + opts.Page = resp.NextPage } + return strings.Join(log, "\n"), nil }