From 40b2bc4c4fc5abae5d660d544d91c73e552dd487 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 23:00:09 +0200 Subject: [PATCH] Update module github.com/google/go-github/v88 to v89 (#6838) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de> --- go.mod | 2 +- go.sum | 4 +-- server/forge/github/convert.go | 2 +- server/forge/github/convert_test.go | 2 +- server/forge/github/github.go | 6 ++-- server/forge/github/github_test.go | 53 ++++++++++++++++++++++++++++- server/forge/github/parse.go | 2 +- 7 files changed, 61 insertions(+), 10 deletions(-) diff --git a/go.mod b/go.mod index 3d6492f4b..69cc8caf3 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/go-sql-driver/mysql v1.10.0 github.com/go-viper/mapstructure/v2 v2.5.0 github.com/golang-jwt/jwt/v5 v5.3.1 - github.com/google/go-github/v88 v88.0.0 + github.com/google/go-github/v89 v89.0.0 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-plugin v1.8.0 github.com/jellydator/ttlcache/v3 v3.4.1 diff --git a/go.sum b/go.sum index bdcfc2d93..0fa906def 100644 --- a/go.sum +++ b/go.sum @@ -284,8 +284,8 @@ 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/v73 v73.0.0 h1:aR+Utnh+Y4mMkS+2qLQwcQ/cF9mOTpdwnzlaw//rG24= github.com/google/go-github/v73 v73.0.0/go.mod h1:fa6w8+/V+edSU0muqdhCVY7Beh1M8F1IlQPZIANKIYw= -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/v89 v89.0.0 h1:35bEK5XoEcF3PZrlVbl9XN63f5BcJRA/UGkxeC9xPg0= +github.com/google/go-github/v89 v89.0.0/go.mod h1:QLcbU0ipeAqQuR5KSg8c2lql4Qk1EwJ2dWz/0rP4Nho= 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/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= diff --git a/server/forge/github/convert.go b/server/forge/github/convert.go index 2d6d30b06..a972ef0f7 100644 --- a/server/forge/github/convert.go +++ b/server/forge/github/convert.go @@ -18,7 +18,7 @@ package github import ( "fmt" - "github.com/google/go-github/v88/github" + "github.com/google/go-github/v89/github" "go.woodpecker-ci.org/woodpecker/v3/server/model" ) diff --git a/server/forge/github/convert_test.go b/server/forge/github/convert_test.go index a8e161f2c..fbbd7e80b 100644 --- a/server/forge/github/convert_test.go +++ b/server/forge/github/convert_test.go @@ -18,7 +18,7 @@ package github import ( "testing" - "github.com/google/go-github/v88/github" + "github.com/google/go-github/v89/github" "github.com/stretchr/testify/assert" "go.woodpecker-ci.org/woodpecker/v3/server/model" diff --git a/server/forge/github/github.go b/server/forge/github/github.go index c8d8260dd..dcebe8945 100644 --- a/server/forge/github/github.go +++ b/server/forge/github/github.go @@ -27,7 +27,7 @@ import ( "strings" "time" - "github.com/google/go-github/v88/github" + "github.com/google/go-github/v89/github" "github.com/rs/zerolog/log" "golang.org/x/oauth2" @@ -588,8 +588,8 @@ func (c *client) Status(ctx context.Context, user *model.User, repo *model.Repo, } id, _ := strconv.Atoi(matches[1]) - _, _, err := client.Repositories.CreateDeploymentStatus(ctx, repo.Owner, repo.Name, int64(id), &github.DeploymentStatusRequest{ - State: github.Ptr(convertStatus(pipeline.Status)), + _, _, err := client.Repositories.CreateDeploymentStatus(ctx, repo.Owner, repo.Name, int64(id), github.DeploymentStatusRequest{ + State: convertStatus(pipeline.Status), Description: github.Ptr(common.GetPipelineStatusDescription(pipeline.Status)), LogURL: github.Ptr(common.GetPipelineStatusURL(repo, pipeline, nil)), }) diff --git a/server/forge/github/github_test.go b/server/forge/github/github_test.go index 7ffc1fafb..595d19b7a 100644 --- a/server/forge/github/github_test.go +++ b/server/forge/github/github_test.go @@ -17,12 +17,14 @@ package github import ( "context" + "encoding/json" + "net/http" "net/http/httptest" "strings" "testing" "github.com/gin-gonic/gin" - "github.com/google/go-github/v88/github" + "github.com/google/go-github/v89/github" github_mock "github.com/migueleliasweb/go-github-mock/src/mock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -95,6 +97,55 @@ func Test_github(t *testing.T) { }) } +func TestStatusDeployment(t *testing.T) { + var ( + method string + path string + decodeErr error + body struct { + State string `json:"state"` + Description string `json:"description"` + LogURL string `json:"log_url"` + } + ) + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + method = r.Method + path = r.URL.Path + decodeErr = json.NewDecoder(r.Body).Decode(&body) + w.Header().Set("Content-Type", "application/json") + _, _ = w.Write([]byte(`{}`)) + })) + t.Cleanup(server.Close) + + gh, err := github.NewClient( + github.WithURLs(github.Ptr(server.URL+"/"), nil), + github.WithHTTPClient(server.Client()), + ) + require.NoError(t, err) + + ctx := context.WithValue(t.Context(), githubClientKey, gh) + c := &client{} + err = c.Status(ctx, fakeUser, &model.Repo{ + ID: 7, + Owner: "octocat", + Name: "Hello-World", + }, &model.Pipeline{ + Number: 9, + Event: model.EventDeploy, + Status: model.StatusSuccess, + ForgeURL: "https://api.github.com/repos/octocat/Hello-World/deployments/42", + }, nil) + require.NoError(t, err) + + assert.Equal(t, http.MethodPost, method) + assert.Equal(t, "/repos/octocat/Hello-World/deployments/42/statuses", path) + require.NoError(t, decodeErr) + assert.Equal(t, "success", body.State) + assert.Equal(t, "Pipeline was successful", body.Description) + assert.Contains(t, body.LogURL, "/repos/7/pipeline/9") +} + var ( fakeUser = &model.User{ Login: "6543", diff --git a/server/forge/github/parse.go b/server/forge/github/parse.go index 2334d3015..f3482cb02 100644 --- a/server/forge/github/parse.go +++ b/server/forge/github/parse.go @@ -22,7 +22,7 @@ import ( "net/http" "strings" - "github.com/google/go-github/v88/github" + "github.com/google/go-github/v89/github" "github.com/rs/zerolog/log" "go.woodpecker-ci.org/woodpecker/v3/server/forge/common"