diff --git a/go.mod b/go.mod index c7ae01d..535e9ff 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ require ( charm.land/lipgloss/v2 v2.0.6 github.com/bradleyfalzon/ghinstallation/v2 v2.19.0 github.com/go-git/go-git/v5 v5.19.2 - github.com/google/go-github/v68 v68.0.0 + github.com/google/go-github/v92 v92.0.0 github.com/shurcooL/githubv4 v0.0.0-20260209031235-2402fdf4a9ed github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.12.1 diff --git a/go.sum b/go.sum index b250c43..536d59e 100644 --- a/go.sum +++ b/go.sum @@ -67,10 +67,10 @@ github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUv github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/go-github/v68 v68.0.0 h1:ZW57zeNZiXTdQ16qrDiZ0k6XucrxZ2CGmoTvcCyQG6s= -github.com/google/go-github/v68 v68.0.0/go.mod h1:K9HAUBovM2sLwM408A18h+wd9vqdLOEqTUCbnRIcx68= github.com/google/go-github/v88 v88.0.0 h1:dZA9IKkPK1eXZj4ypngnpRj5FwdpTv4whix2PrQMP7M= github.com/google/go-github/v88 v88.0.0/go.mod h1:rufTDgn2N45wjhukLTyxmvc9nilSp3mr3Rgtt6b1MPw= +github.com/google/go-github/v92 v92.0.0 h1:4vW4RVffwIvoEfIA4RX09mRSB47qQX557/2+HgeWRRg= +github.com/google/go-github/v92 v92.0.0/go.mod h1:w3CH62ZcmRfvW1cdXpyTztSOVMtdjxtKpgo0GouLmjY= github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= diff --git a/internal/github/client.go b/internal/github/client.go index 4e355de..2069d34 100644 --- a/internal/github/client.go +++ b/internal/github/client.go @@ -11,7 +11,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v68/github" + "github.com/google/go-github/v92/github" "github.com/lukaszraczylo/git-velocity/internal/config" "github.com/lukaszraczylo/git-velocity/internal/domain/models" @@ -50,10 +50,14 @@ type Client struct { // NewClient creates a new GitHub client with the appropriate authentication func NewClient(ctx context.Context, cfg *config.Config) (*Client, error) { var gh *github.Client + var err error // Determine authentication method if cfg.HasGithubToken() { - gh = github.NewClient(nil).WithAuthToken(cfg.Auth.GithubToken) + gh, err = github.NewClient(github.WithAuthToken(cfg.Auth.GithubToken)) + if err != nil { + return nil, fmt.Errorf("failed to create GitHub client: %w", err) + } } else if cfg.HasGithubApp() { // GitHub App authentication privateKey, err := cfg.GetGithubAppPrivateKey() @@ -71,7 +75,10 @@ func NewClient(ctx context.Context, cfg *config.Config) (*Client, error) { return nil, fmt.Errorf("failed to create GitHub App transport: %w", err) } - gh = github.NewClient(&http.Client{Transport: itr}) + gh, err = github.NewClient(github.WithHTTPClient(&http.Client{Transport: itr})) + if err != nil { + return nil, fmt.Errorf("failed to create GitHub client: %w", err) + } } else { return nil, fmt.Errorf("no authentication method configured") } @@ -528,7 +535,7 @@ func (c *Client) FetchIssues(ctx context.Context, owner, repo string, since, unt fetcher := &DateFilteredFetcher[*github.Issue, models.Issue]{ FetchFn: func(ctx context.Context, page int) ([]*github.Issue, *github.Response, error) { - opts.Page = page + opts.ListOptions.Page = page var issues []*github.Issue var resp *github.Response err := c.retryWithBackoff(ctx, "list issues", func() error { @@ -561,8 +568,8 @@ func (c *Client) FetchIssueComments(ctx context.Context, owner, repo string, sin cacheKey := fmt.Sprintf("issue_comments:%s/%s:%v:%v", owner, repo, since, until) opts := &github.IssueListCommentsOptions{ - Sort: github.Ptr("created"), - Direction: github.Ptr("desc"), + Sort: new("created"), + Direction: new("desc"), ListOptions: github.ListOptions{ PerPage: 100, }, diff --git a/internal/github/fetcher.go b/internal/github/fetcher.go index da3a0db..ab78629 100644 --- a/internal/github/fetcher.go +++ b/internal/github/fetcher.go @@ -5,7 +5,7 @@ import ( "fmt" "time" - "github.com/google/go-github/v68/github" + "github.com/google/go-github/v92/github" ) // DateFilterResult represents the result of date filtering