From 636eae8fcd466b96d6d2bb6bdd060ffb5770df5e Mon Sep 17 00:00:00 2001 From: "renovate-vince-riv[bot]" <227500739+renovate-vince-riv[bot]@users.noreply.github.com> Date: Sun, 31 May 2026 15:37:11 +0000 Subject: [PATCH 1/2] chore(deps): update module github.com/google/go-github/v85 to v88.0.0 --- go.mod | 3 +-- go.sum | 2 -- internal/github/comment.go | 2 +- internal/github/comment_test.go | 2 +- internal/github/status.go | 2 +- internal/webhook/process.go | 2 +- 6 files changed, 5 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 3f11f90..d02d6e1 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.25.7 require ( github.com/akedrou/textdiff v0.1.0 github.com/bradleyfalzon/ghinstallation/v2 v2.19.0 - github.com/google/go-github/v85 v85.0.0 + github.com/google/go-github/v88 v88.0.0 github.com/rs/zerolog v1.35.1 github.com/spf13/pflag v1.0.10 k8s.io/apimachinery v0.35.4 @@ -18,7 +18,6 @@ require ( github.com/fxamacker/cbor/v2 v2.9.0 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/golang-jwt/jwt/v4 v4.5.2 // indirect - github.com/google/go-github/v88 v88.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kr/text v0.2.0 // indirect diff --git a/go.sum b/go.sum index 404470b..3f469e2 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,6 @@ github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w 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/v85 v85.0.0 h1:1+TLFX/akTFXK7o9Z9uAloQGufOn4ySa5DItUM1VWT4= -github.com/google/go-github/v85 v85.0.0/go.mod h1:jYkBnqN+SzR2A2fGKYfbt6DEEQAyxeK0Q2XpPV9ZFsU= 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-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0= diff --git a/internal/github/comment.go b/internal/github/comment.go index 58f930c..9f8738f 100644 --- a/internal/github/comment.go +++ b/internal/github/comment.go @@ -12,7 +12,7 @@ import ( "time" ghinstallation "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v85/github" + "github.com/google/go-github/v88/github" "github.com/rs/zerolog/log" ) diff --git a/internal/github/comment_test.go b/internal/github/comment_test.go index 0effe9e..6651631 100644 --- a/internal/github/comment_test.go +++ b/internal/github/comment_test.go @@ -14,7 +14,7 @@ import ( "strings" "testing" - "github.com/google/go-github/v85/github" + "github.com/google/go-github/v88/github" ) const testDataDir = "github_testdata" diff --git a/internal/github/status.go b/internal/github/status.go index a53c1b3..d0183b3 100644 --- a/internal/github/status.go +++ b/internal/github/status.go @@ -9,7 +9,7 @@ import ( "strings" ghinstallation "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v85/github" + "github.com/google/go-github/v88/github" "github.com/rs/zerolog/log" ) diff --git a/internal/webhook/process.go b/internal/webhook/process.go index 9a908ab..6df3db7 100644 --- a/internal/webhook/process.go +++ b/internal/webhook/process.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/google/go-github/v85/github" + "github.com/google/go-github/v88/github" "github.com/rs/zerolog/log" argoDiffGh "github.com/vince-riv/argo-diff/internal/github" From 47395152a4e61b877a413cfa7336439c68fd61c9 Mon Sep 17 00:00:00 2001 From: Vincent Rivellino Date: Sun, 28 Jun 2026 12:51:14 -0400 Subject: [PATCH 2/2] fix: update github client construction for go-github v88 API changes go-github v87 changed NewClient() to return (*Client, error) and accept variadic ClientOptionsFunc instead of *http.Client. WithAuthToken is now a package-level option func rather than a method on *Client. Custom transports now use WithHTTPClient(). Tests updated to use WithURLs() in place of direct BaseURL/UploadURL field assignment. --- internal/github/comment.go | 26 +++++++++++--- internal/github/comment_test.go | 61 +++++++++++++++++++-------------- internal/github/status.go | 17 +++++++-- 3 files changed, 72 insertions(+), 32 deletions(-) diff --git a/internal/github/comment.go b/internal/github/comment.go index 9f8738f..f3453ae 100644 --- a/internal/github/comment.go +++ b/internal/github/comment.go @@ -45,9 +45,19 @@ func init() { } // Create Github API client if githubPAT := os.Getenv("GITHUB_PERSONAL_ACCESS_TOKEN"); githubPAT != "" { - commentClient = github.NewClient(nil).WithAuthToken(githubPAT) + var err error + commentClient, err = github.NewClient(github.WithAuthToken(githubPAT)) + if err != nil { + log.Error().Err(err).Msg("Failed to create github client") + return + } } else if githubToken := os.Getenv("GITHUB_TOKEN"); githubToken != "" { - commentClient = github.NewClient(nil).WithAuthToken(githubToken) + var err error + commentClient, err = github.NewClient(github.WithAuthToken(githubToken)) + if err != nil { + log.Error().Err(err).Msg("Failed to create github client") + return + } } else { tr := http.DefaultTransport appId, err := strconv.ParseInt(os.Getenv("GITHUB_APP_ID"), 10, 64) @@ -67,8 +77,16 @@ func init() { return } itr := ghinstallation.NewFromAppsTransport(atr, installId) - commentClient = github.NewClient(&http.Client{Transport: itr}) - appsClient = github.NewClient(&http.Client{Transport: atr}) // /app endpoints need separate client + commentClient, err = github.NewClient(github.WithHTTPClient(&http.Client{Transport: itr})) + if err != nil { + log.Error().Err(err).Msg("Failed to create github comment client") + return + } + appsClient, err = github.NewClient(github.WithHTTPClient(&http.Client{Transport: atr})) + if err != nil { + log.Error().Err(err).Msg("Failed to create github apps client") + return + } commentClientIsApp = true } } diff --git a/internal/github/comment_test.go b/internal/github/comment_test.go index 6651631..e88761b 100644 --- a/internal/github/comment_test.go +++ b/internal/github/comment_test.go @@ -8,7 +8,6 @@ import ( "io" "net/http" "net/http/httptest" - "net/url" "os" "path/filepath" "strings" @@ -174,10 +173,12 @@ func newHttpTestServer(t *testing.T) *httptest.Server { func TestCommentNoExistingComments(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } c, err := getExistingComments(context.Background(), "vince-riv", "argo-diff", 1) if err != nil { @@ -199,10 +200,12 @@ func TestCommentNoExistingComments(t *testing.T) { func TestCommentExistingDifferentUser(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } c, err := getExistingComments(context.Background(), "vince-riv", "argo-diff", 2) if err != nil { @@ -224,10 +227,12 @@ func TestCommentExistingDifferentUser(t *testing.T) { func TestCommentExisting(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } c, err := getExistingComments(context.Background(), "vince-riv", "argo-diff", 3) if err != nil { @@ -251,10 +256,12 @@ func TestCommentExisting(t *testing.T) { func TestCommentExistingMulti(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } c, err := getExistingComments(context.Background(), "vince-riv", "argo-diff", 4) if err != nil { @@ -287,10 +294,12 @@ func TestCommentExistingMulti(t *testing.T) { func TestCommentExistingMultiNoComment(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } c, err := getExistingComments(context.Background(), "vince-riv", "argo-diff", 4) if err != nil { @@ -323,10 +332,12 @@ func TestCommentExistingMultiNoComment(t *testing.T) { func TestCommentNotHead(t *testing.T) { server := newHttpTestServer(t) defer server.Close() - httpBaseUrl, _ := url.Parse(server.URL + "/") - commentClient = github.NewClient(nil).WithAuthToken("test1234") - commentClient.BaseURL = httpBaseUrl - commentClient.UploadURL = httpBaseUrl + baseURL := server.URL + "/" + var err error + commentClient, err = github.NewClient(github.WithAuthToken("test1234"), github.WithURLs(&baseURL, &baseURL)) + if err != nil { + t.Fatalf("Failed to create github client: %s", err) + } prHeadShaOld := "1111111111111111111111111111111111111111" diff --git a/internal/github/status.go b/internal/github/status.go index d0183b3..cb13ba9 100644 --- a/internal/github/status.go +++ b/internal/github/status.go @@ -37,11 +37,19 @@ func init() { } // Create Github API client if githubPAT := os.Getenv("GITHUB_PERSONAL_ACCESS_TOKEN"); githubPAT != "" { - statusClient = github.NewClient(nil).WithAuthToken(githubPAT) + var err error + statusClient, err = github.NewClient(github.WithAuthToken(githubPAT)) + if err != nil { + log.Error().Err(err).Msg("Failed to create github status client") + } return } if githubToken := os.Getenv("GITHUB_TOKEN"); githubToken != "" { - statusClient = github.NewClient(nil).WithAuthToken(githubToken) + var err error + statusClient, err = github.NewClient(github.WithAuthToken(githubToken)) + if err != nil { + log.Error().Err(err).Msg("Failed to create github status client") + } return } tr := http.DefaultTransport @@ -61,7 +69,10 @@ func init() { log.Error().Err(err).Msgf("Failed to create github client: appId %d, installId %d, privKey %s...", appId, installId, privKey[:15]) return } - statusClient = github.NewClient(&http.Client{Transport: itr}) + statusClient, err = github.NewClient(github.WithHTTPClient(&http.Client{Transport: itr})) + if err != nil { + log.Error().Err(err).Msg("Failed to create github status client") + } } // Helper that sets commit status for the request commit sha