Skip to content

Commit b6058f9

Browse files
grokifyclaude
andcommitted
chore(deps): upgrade go-github from v84 to v88
Updates github.com/google/go-github from v84.0.0 to v88.0.0. Breaking changes in v88: - NewClient now returns (*Client, error) instead of *Client - WithAuthToken and WithEnterpriseURLs are now ClientOptionsFunc parameters passed to NewClient, not methods on Client Updates all 29 files to use the new API pattern. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0cc69a1 commit b6058f9

29 files changed

Lines changed: 91 additions & 54 deletions

auth/app.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"time"
1212

1313
"github.com/golang-jwt/jwt/v5"
14-
"github.com/google/go-github/v84/github"
14+
"github.com/google/go-github/v88/github"
1515
)
1616

1717
// JWT constants for GitHub App authentication.
@@ -163,7 +163,10 @@ func NewAppClient(ctx context.Context, cfg *AppConfig) (*github.Client, error) {
163163
}
164164

165165
// Create client with JWT auth to get installation token
166-
jwtClient := github.NewClient(nil).WithAuthToken(token)
166+
jwtClient, err := github.NewClient(github.WithAuthToken(token))
167+
if err != nil {
168+
return nil, fmt.Errorf("creating github client: %w", err)
169+
}
167170

168171
// Get installation access token
169172
installToken, _, err := jwtClient.Apps.CreateInstallationToken(ctx, cfg.InstallationID, nil)
@@ -172,7 +175,10 @@ func NewAppClient(ctx context.Context, cfg *AppConfig) (*github.Client, error) {
172175
}
173176

174177
// Create client with installation token
175-
client := github.NewClient(nil).WithAuthToken(installToken.GetToken())
178+
client, err := github.NewClient(github.WithAuthToken(installToken.GetToken()))
179+
if err != nil {
180+
return nil, fmt.Errorf("creating github client: %w", err)
181+
}
176182

177183
return client, nil
178184
}
@@ -220,7 +226,10 @@ func ListAppInstallations(ctx context.Context, cfg *AppConfig) ([]AppInstallatio
220226
return nil, fmt.Errorf("creating JWT: %w", err)
221227
}
222228

223-
client := github.NewClient(nil).WithAuthToken(token)
229+
client, err := github.NewClient(github.WithAuthToken(token))
230+
if err != nil {
231+
return nil, fmt.Errorf("creating github client: %w", err)
232+
}
224233

225234
installations, _, err := client.Apps.ListInstallations(ctx, nil)
226235
if err != nil {

auth/auth.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"context"
66
"net/http"
77

8-
"github.com/google/go-github/v84/github"
8+
"github.com/google/go-github/v88/github"
99
"golang.org/x/oauth2"
1010
)
1111

@@ -41,8 +41,8 @@ func NewTokenClient(ctx context.Context, token string) *http.Client {
4141
}
4242

4343
// NewGitHubClient creates a GitHub client authenticated with the given token.
44-
func NewGitHubClient(ctx context.Context, token string) *github.Client {
45-
return github.NewClient(NewTokenClient(ctx, token))
44+
func NewGitHubClient(ctx context.Context, token string) (*github.Client, error) {
45+
return github.NewClient(github.WithHTTPClient(NewTokenClient(ctx, token)))
4646
}
4747

4848
// GetAuthenticatedUser returns the authenticated user's login.

checks/checks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"time"
88

9-
"github.com/google/go-github/v84/github"
9+
"github.com/google/go-github/v88/github"
1010
)
1111

1212
// ListCheckRuns lists check runs for a commit SHA or branch.

checks/checks_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package checks
33
import (
44
"testing"
55

6-
"github.com/google/go-github/v84/github"
6+
"github.com/google/go-github/v88/github"
77
)
88

99
func ptr[T any](v T) *T {

cmd/gogithub/cmd_profile.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"strings"
1111
"time"
1212

13-
"github.com/google/go-github/v84/github"
13+
"github.com/google/go-github/v88/github"
1414
"github.com/grokify/mogo/fmt/progress"
1515
"github.com/spf13/cobra"
1616

@@ -257,7 +257,10 @@ func runProfileFromAPI() error {
257257
ctx := context.Background()
258258

259259
// Create clients
260-
restClient := github.NewClient(nil).WithAuthToken(token)
260+
restClient, err := github.NewClient(github.WithAuthToken(token))
261+
if err != nil {
262+
return fmt.Errorf("creating github client: %w", err)
263+
}
261264
gqlClient := graphql.NewClient(ctx, token)
262265

263266
fmt.Fprintf(os.Stderr, "Fetching profile for '%s' from %s to %s\n\n",

cmd/gogithub/cmd_search_prs.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77
"strings"
88

9-
"github.com/google/go-github/v84/github"
9+
"github.com/google/go-github/v88/github"
1010
"github.com/grokify/gogithub/search"
1111
"github.com/spf13/cobra"
1212
)
@@ -47,7 +47,11 @@ func runSearchPRs(cmd *cobra.Command, args []string) error {
4747
}
4848

4949
// Create unauthenticated client for public data
50-
c := search.NewClient(github.NewClient(nil))
50+
ghClient, err := github.NewClient()
51+
if err != nil {
52+
return fmt.Errorf("creating github client: %w", err)
53+
}
54+
c := search.NewClient(ghClient)
5155

5256
ii := search.Issues{}
5357

cmd/searchuserpr/main.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"strings"
99

10-
"github.com/google/go-github/v84/github"
10+
"github.com/google/go-github/v88/github"
1111
"github.com/grokify/gogithub/search"
1212
"github.com/grokify/mogo/log/logutil"
1313
flags "github.com/jessevdk/go-flags"
@@ -35,7 +35,11 @@ func main() {
3535
os.Exit(0)
3636
}
3737

38-
c := search.NewClient(github.NewClient(nil))
38+
ghClient, err := github.NewClient()
39+
if err != nil {
40+
log.Fatal(err)
41+
}
42+
c := search.NewClient(ghClient)
3943

4044
ii := search.Issues{}
4145

config/config.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"errors"
77
"os"
88

9-
"github.com/google/go-github/v84/github"
9+
"github.com/google/go-github/v88/github"
1010
"golang.org/x/oauth2"
1111
)
1212

@@ -244,11 +244,12 @@ func (c *Config) NewClient(ctx context.Context) (*github.Client, error) {
244244
)
245245
tc := oauth2.NewClient(ctx, ts)
246246

247+
opts := []github.ClientOptionsFunc{github.WithHTTPClient(tc)}
247248
if c.IsEnterprise() {
248-
return github.NewClient(tc).WithEnterpriseURLs(c.BaseURL, c.UploadURL)
249+
opts = append(opts, github.WithEnterpriseURLs(c.BaseURL, c.UploadURL))
249250
}
250251

251-
return github.NewClient(tc), nil
252+
return github.NewClient(opts...)
252253
}
253254

254255
// MustNewClient creates a GitHub client from the configuration.

errors/errors.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77
"net/http"
88

9-
"github.com/google/go-github/v84/github"
9+
"github.com/google/go-github/v88/github"
1010
)
1111

1212
// Standard errors for GitHub operations.

errors/errors_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"net/http"
66
"testing"
77

8-
"github.com/google/go-github/v84/github"
8+
"github.com/google/go-github/v88/github"
99
)
1010

1111
func TestTranslateNotFound(t *testing.T) {

0 commit comments

Comments
 (0)