Skip to content

Commit 8c5ad3e

Browse files
authored
chore(deps): bump go-github (#270)
1 parent d86ecab commit 8c5ad3e

File tree

4 files changed

+23
-15
lines changed

4 files changed

+23
-15
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25
55
require (
66
github.com/alexflint/go-arg v1.6.0
77
github.com/aws/aws-sdk-go v1.49.4
8-
github.com/google/go-github/v56 v56.0.0
8+
github.com/google/go-github/v82 v82.0.0
99
github.com/johannesboyne/gofakes3 v0.0.0-20230914150226-f005f5cc03aa
1010
github.com/narqo/go-badge v0.0.0-20230821190521-c9a75c019a59
1111
github.com/rs/zerolog v1.34.0
@@ -18,7 +18,7 @@ require (
1818
github.com/alexflint/go-scalar v1.2.0 // indirect
1919
github.com/davecgh/go-spew v1.1.1 // indirect
2020
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
21-
github.com/google/go-querystring v1.1.0 // indirect
21+
github.com/google/go-querystring v1.2.0 // indirect
2222
github.com/jmespath/go-jmespath v0.4.0 // indirect
2323
github.com/kr/pretty v0.3.1 // indirect
2424
github.com/mattn/go-colorable v0.1.13 // indirect

go.sum

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
1313
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
1414
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
1515
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
16-
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
17-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
1816
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
19-
github.com/google/go-github/v56 v56.0.0 h1:TysL7dMa/r7wsQi44BjqlwaHvwlFlqkK8CtBWCX3gb4=
20-
github.com/google/go-github/v56 v56.0.0/go.mod h1:D8cdcX98YWJvi7TLo7zM4/h8ZTx6u6fwGEkCdisopo0=
21-
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
22-
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
17+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
18+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
19+
github.com/google/go-github/v82 v82.0.0 h1:OH09ESON2QwKCUVMYmMcVu1IFKFoaZHwqYaUtr/MVfk=
20+
github.com/google/go-github/v82 v82.0.0/go.mod h1:hQ6Xo0VKfL8RZ7z1hSfB4fvISg0QqHOqe9BP0qo+WvM=
21+
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
22+
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
2323
github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg=
2424
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
2525
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
@@ -116,7 +116,6 @@ golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
116116
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
117117
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
118118
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
119-
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
120119
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
121120
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
122121
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=

pkg/testcoverage/badgestorer/github.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package badgestorer
22

33
import (
44
"context"
5+
"errors"
56
"fmt"
67
"net/http"
78

8-
"github.com/google/go-github/v56/github"
9+
"github.com/google/go-github/v82/github"
910
)
1011

1112
type Git struct {
@@ -30,6 +31,7 @@ func NewGithub(cfg Git) Storer {
3031
return &githubStorer{cfg: cfg}
3132
}
3233

34+
//nolint:maintidx // relax
3335
func (s *githubStorer) Store(data []byte) (bool, error) {
3436
git := s.cfg
3537
client := github.NewClient(nil).WithAuthToken(git.Token)
@@ -41,7 +43,7 @@ func (s *githubStorer) Store(data []byte) (bool, error) {
4143
git.Repository,
4244
git.FileName,
4345
&github.RepositoryContentFileOptions{
44-
Message: github.String("update badge " + git.FileName),
46+
Message: github.Ptr("update badge " + git.FileName),
4547
Content: data,
4648
Branch: &git.Branch,
4749
SHA: sha,
@@ -61,8 +63,15 @@ func (s *githubStorer) Store(data []byte) (bool, error) {
6163
git.FileName,
6264
&github.RepositoryContentGetOptions{Ref: git.Branch},
6365
)
64-
if httpResp.StatusCode == http.StatusNotFound { // when badge is not found create it
65-
return updateBadge(nil)
66+
67+
var ghErr *github.ErrorResponse
68+
if errors.As(err, &ghErr) &&
69+
ghErr.Response != nil && ghErr.Response.StatusCode == http.StatusNotFound { // coverage-ignore
70+
return updateBadge(nil) // when badge is not found create it
71+
}
72+
73+
if httpResp != nil && httpResp.StatusCode == http.StatusNotFound { // coverage-ignore
74+
return updateBadge(nil) // when badge is not found create it
6675
}
6776

6877
if err != nil { // coverage-ignore

pkg/testcoverage/badgestorer/github_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"testing"
99

10-
"github.com/google/go-github/v56/github"
10+
"github.com/google/go-github/v82/github"
1111
"github.com/stretchr/testify/assert"
1212

1313
. "github.com/vladopajic/go-test-coverage/v2/pkg/testcoverage/badgestorer"
@@ -102,7 +102,7 @@ func deleteFile(t *testing.T, cfg Git) {
102102
cfg.Repository,
103103
cfg.FileName,
104104
&github.RepositoryContentFileOptions{
105-
Message: github.String("delete testing badge " + cfg.FileName),
105+
Message: github.Ptr("delete testing badge " + cfg.FileName),
106106
Branch: &cfg.Branch,
107107
SHA: fc.SHA,
108108
},

0 commit comments

Comments
 (0)