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>
This commit is contained in:
renovate[bot]
2026-07-13 23:00:09 +02:00
committed by GitHub
co-authored by lnx01 6543
parent 2bc7837703
commit 40b2bc4c4f
7 changed files with 61 additions and 10 deletions
+1 -1
View File
@@ -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"
)
+1 -1
View File
@@ -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"
+3 -3
View File
@@ -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)),
})
+52 -1
View File
@@ -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",
+1 -1
View File
@@ -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"