Skip to content

Commit

Permalink
chore: update github.com/google/go-github to v68 (#5231)
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lkc authored Jan 22, 2025
1 parent 65d03c6 commit 672154a
Show file tree
Hide file tree
Showing 36 changed files with 47 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cmd/checkmarxExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/bmatcuk/doublestar"
"github.com/pkg/errors"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
)

type checkmarxExecuteScanUtils interface {
Expand Down
2 changes: 1 addition & 1 deletion cmd/checkmarxExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/SAP/jenkins-library/pkg/checkmarx"
"github.com/stretchr/testify/assert"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
)

type fileInfo struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/checkmarxOneExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/SAP/jenkins-library/pkg/toolrecord"
"github.com/bmatcuk/doublestar"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/detectExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/SAP/jenkins-library/pkg/toolrecord"
"github.com/SAP/jenkins-library/pkg/versioning"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/detectExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/SAP/jenkins-library/pkg/mock"
"github.com/SAP/jenkins-library/pkg/orchestrator"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
7 changes: 3 additions & 4 deletions cmd/fortifyExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (

"github.com/bmatcuk/doublestar"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/google/uuid"

"github.com/piper-validation/fortify-client-go/models"
Expand Down Expand Up @@ -52,7 +52,7 @@ gradle.allprojects {
`

type pullRequestService interface {
ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error)
ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.ListOptions) ([]*github.PullRequest, *github.Response, error)
}

type fortifyUtils interface {
Expand Down Expand Up @@ -1141,8 +1141,7 @@ func determinePullRequestMerge(config fortifyExecuteScanOptions) (string, string
func determinePullRequestMergeGithub(ctx context.Context, config fortifyExecuteScanOptions, pullRequestServiceInstance pullRequestService) (string, string, error) {
number := "0"
author := ""
options := github.PullRequestListOptions{State: "closed", Sort: "updated", Direction: "desc"}
prList, _, err := pullRequestServiceInstance.ListPullRequestsWithCommit(ctx, config.Owner, config.Repository, config.CommitID, &options)
prList, _, err := pullRequestServiceInstance.ListPullRequestsWithCommit(ctx, config.Owner, config.Repository, config.CommitID, &github.ListOptions{})
if err == nil && prList != nil && len(prList) > 0 {
number = fmt.Sprintf("%v", prList[0].GetNumber())
if prList[0].GetUser() != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/fortifyExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/versioning"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"

"github.com/piper-validation/fortify-client-go/models"
Expand Down Expand Up @@ -359,7 +359,7 @@ func (f *fortifyMock) DownloadResultFile(endpoint string, projectVersionID int64

type pullRequestServiceMock struct{}

func (prService pullRequestServiceMock) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) {
func (prService pullRequestServiceMock) ListPullRequestsWithCommit(ctx context.Context, owner, repo, sha string, opts *github.ListOptions) ([]*github.PullRequest, *github.Response, error) {
authorString := author
user := github.User{Login: &authorString}
if owner == "A" {
Expand Down
6 changes: 3 additions & 3 deletions cmd/githubCheckBranchProtection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"

"github.com/pkg/errors"

Expand Down Expand Up @@ -41,8 +41,8 @@ func runGithubCheckBranchProtection(ctx context.Context, config *githubCheckBran
for _, check := range config.RequiredChecks {
var found bool
foundContexts := []string{}
if requiredStatusChecks := ghProtection.GetRequiredStatusChecks(); requiredStatusChecks != nil {
foundContexts = requiredStatusChecks.Contexts
if requiredStatusChecks := ghProtection.GetRequiredStatusChecks(); requiredStatusChecks != nil && requiredStatusChecks.Contexts != nil {
foundContexts = *requiredStatusChecks.Contexts
}
for _, context := range foundContexts {
if check == context {
Expand Down
6 changes: 3 additions & 3 deletions cmd/githubCheckBranchProtection_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/SAP/jenkins-library/pkg/telemetry"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down Expand Up @@ -61,7 +61,7 @@ func TestRunGithubCheckBranchProtection(t *testing.T) {
RequiredApprovingReviewCount: 1,
}
ghRepo := ghCheckBranchRepoService{protection: github.Protection{
RequiredStatusChecks: &github.RequiredStatusChecks{Contexts: []string{"check0", "check1", "check2", "check3"}},
RequiredStatusChecks: &github.RequiredStatusChecks{Contexts: &[]string{"check0", "check1", "check2", "check3"}},
EnforceAdmins: &github.AdminEnforcement{Enabled: true},
RequiredPullRequestReviews: &github.PullRequestReviewsEnforcement{RequiredApprovingReviewCount: 1},
}}
Expand All @@ -86,7 +86,7 @@ func TestRunGithubCheckBranchProtection(t *testing.T) {
RequiredChecks: []string{"check1", "check2"},
}
ghRepo := ghCheckBranchRepoService{protection: github.Protection{
RequiredStatusChecks: &github.RequiredStatusChecks{Contexts: []string{"check0", "check1"}},
RequiredStatusChecks: &github.RequiredStatusChecks{Contexts: &[]string{"check0", "check1"}},
}}
err := runGithubCheckBranchProtection(ctx, &config, &telemetryData, &ghRepo)
assert.Contains(t, fmt.Sprint(err), "required status check 'check2' not found")
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCommentIssue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"

piperGithub "github.com/SAP/jenkins-library/pkg/github"
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCommentIssue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"testing"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCreateIssue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/pkg/errors"

piperGithub "github.com/SAP/jenkins-library/pkg/github"
github "github.com/google/go-github/v45/github"
github "github.com/google/go-github/v68/github"
)

type githubCreateIssueUtils interface {
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCreateIssue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

piperGithub "github.com/SAP/jenkins-library/pkg/github"
"github.com/SAP/jenkins-library/pkg/mock"
github "github.com/google/go-github/v45/github"
github "github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCreatePullRequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"

piperGithub "github.com/SAP/jenkins-library/pkg/github"
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubCreatePullRequest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"net/http"
"testing"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/githubPublishRelease.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"

piperGithub "github.com/SAP/jenkins-library/pkg/github"
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubPublishRelease_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/SAP/jenkins-library/cmd/mocks"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/mock"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/githubSetCommitStatus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/telemetry"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"

"github.com/pkg/errors"

Expand Down
2 changes: 1 addition & 1 deletion cmd/githubSetCommitStatus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/SAP/jenkins-library/pkg/telemetry"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/mocks/GithubRepoClient.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cmd/whitesourceExecuteScan.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"github.com/pkg/errors"
"github.com/xuri/excelize/v2"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
)

// ScanOptions is just used to make the lines less long
Expand Down
2 changes: 1 addition & 1 deletion cmd/whitesourceExecuteScan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"github.com/pkg/errors"
"github.com/stretchr/testify/assert"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
)

type whitesourceUtilsMock struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/go-playground/validator/v10 v10.14.1
github.com/google/go-cmp v0.6.0
github.com/google/go-containerregistry v0.19.0
github.com/google/go-github/v45 v45.2.0
github.com/google/go-github/v68 v68.0.0
github.com/google/uuid v1.6.0
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/vault/api v1.15.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -511,8 +511,8 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-containerregistry v0.19.0 h1:uIsMRBV7m/HDkDxE/nXMnv1q+lOOSPlQ/ywc5JbB8Ic=
github.com/google/go-containerregistry v0.19.0/go.mod h1:u0qB2l7mvtWVR5kNcbFIhFY1hLbf8eeGapA+vbFDCtQ=
github.com/google/go-github/v45 v45.2.0 h1:5oRLszbrkvxDDqBCNj2hjDZMKmvexaZ1xw/FCD+K3FI=
github.com/google/go-github/v45 v45.2.0/go.mod h1:FObaZJEDSTa/WGCzZ2Z3eoCDXWJKMenWWTrd8jrta28=
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-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down
2 changes: 1 addition & 1 deletion pkg/codeql/codeql.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

piperGithub "github.com/SAP/jenkins-library/pkg/github"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
)

type CodeqlScanAudit interface {
Expand Down
6 changes: 3 additions & 3 deletions pkg/codeql/codeql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"errors"
"testing"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand All @@ -34,7 +34,7 @@ func (g *githubCodeqlScanningMock) ListAlertsForRepo(ctx context.Context, owner,
}

if repo == "testRepo2" {
if opts.Page == 1 {
if opts.ListOptions.Page == 1 {
for i := 0; i < 50; i++ {
alerts = append(alerts, &github.Alert{State: &openState, Tool: &github.Tool{Name: &codeqlToolName}, Rule: &github.Rule{Tags: []string{"security"}}})
alerts = append(alerts, &github.Alert{State: &dismissedState, Tool: &github.Tool{Name: &testToolName}, Rule: &github.Rule{Tags: []string{"useless_code"}}})
Expand All @@ -46,7 +46,7 @@ func (g *githubCodeqlScanningMock) ListAlertsForRepo(ctx context.Context, owner,
response.NextPage = 2
}

if opts.Page == 2 {
if opts.ListOptions.Page == 2 {
for i := 0; i < 10; i++ {
alerts = append(alerts, &github.Alert{State: &openState, Tool: &github.Tool{Name: &codeqlToolName}, Rule: &github.Rule{Tags: []string{"security"}}})
alerts = append(alerts, &github.Alert{State: &dismissedState, Tool: &github.Tool{Name: &testToolName}, Rule: &github.Rule{Tags: []string{"useless_code"}}})
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/commit.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package github

import (
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/github/create_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"

"github.com/SAP/jenkins-library/pkg/log"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/github/create_issue_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"regexp"
"testing"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"time"

piperhttp "github.com/SAP/jenkins-library/pkg/http"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
"golang.org/x/oauth2"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/secret.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/rand"
"encoding/base64"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"golang.org/x/crypto/nacl/box"

"github.com/SAP/jenkins-library/pkg/log"
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"encoding/base64"
"testing"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/orchestrator/github_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
piperGithub "github.com/SAP/jenkins-library/pkg/github"
"github.com/SAP/jenkins-library/pkg/log"
"github.com/SAP/jenkins-library/pkg/piperutils"
"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/pkg/errors"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -109,7 +109,7 @@ func (g *githubActionsConfigProvider) FullLogs() ([]byte, error) {
for i := range jobs {
i := i // https://golang.org/doc/faq#closures_and_goroutines
wg.Go(func() error {
_, resp, err := g.client.Actions.GetWorkflowJobLogs(g.ctx, g.owner, g.repo, jobs[i].ID, true)
_, resp, err := g.client.Actions.GetWorkflowJobLogs(g.ctx, g.owner, g.repo, jobs[i].ID, 1)
if err != nil {
// GetWorkflowJobLogs returns "200 OK" as error when log download is successful.
// Therefore, ignore this error.
Expand Down
2 changes: 1 addition & 1 deletion pkg/orchestrator/github_actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"testing"
"time"

"github.com/google/go-github/v45/github"
"github.com/google/go-github/v68/github"
"github.com/jarcoal/httpmock"
"github.com/stretchr/testify/assert"
)
Expand Down
Loading

0 comments on commit 672154a

Please sign in to comment.