mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-03-27 21:49:15 +02:00
chore: update github.com/google/go-github to v68 (#5231)
This commit is contained in:
parent
65d03c6bfe
commit
672154a24d
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
@ -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 {
|
||||
@ -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 {
|
||||
|
@ -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"
|
||||
@ -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" {
|
||||
|
@ -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"
|
||||
|
||||
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
@ -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},
|
||||
}}
|
||||
@ -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")
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -5,7 +5,7 @@ package mocks
|
||||
import (
|
||||
context "context"
|
||||
|
||||
github "github.com/google/go-github/v45/github"
|
||||
github "github.com/google/go-github/v68/github"
|
||||
mock "github.com/stretchr/testify/mock"
|
||||
|
||||
os "os"
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
2
go.mod
2
go.mod
@ -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
|
||||
|
4
go.sum
4
go.sum
@ -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=
|
||||
|
@ -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 {
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
@ -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"}}})
|
||||
@ -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"}}})
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
|
@ -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"
|
||||
)
|
||||
@ -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.
|
||||
|
@ -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"
|
||||
)
|
||||
|
@ -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"
|
||||
)
|
||||
|
||||
type githubIssueService interface {
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-github/v45/github"
|
||||
"github.com/google/go-github/v68/github"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user