Skip to content

Commit 783a6ae

Browse files
authored
Update google/go-github to v75 (#142)
This also requires using Go 1.24 as the minimum version for this module.
1 parent 067447c commit 783a6ae

File tree

7 files changed

+25
-30
lines changed

7 files changed

+25
-30
lines changed

applier.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"time"
1414

1515
"github.com/bluekeyes/go-gitdiff/gitdiff"
16-
"github.com/google/go-github/v74/github"
16+
"github.com/google/go-github/v75/github"
1717
)
1818

1919
// DefaultCommitMessage is the commit message used when no message is provided
@@ -71,7 +71,7 @@ func (a *Applier) Apply(ctx context.Context, f *gitdiff.File) (*github.TreeEntry
7171
}
7272

7373
if entry.Content != nil {
74-
blob, _, err := a.client.Git.CreateBlob(ctx, a.owner, a.repo, &github.Blob{
74+
blob, _, err := a.client.Git.CreateBlob(ctx, a.owner, a.repo, github.Blob{
7575
Content: entry.Content,
7676
Encoding: github.String("base64"),
7777
})
@@ -262,7 +262,7 @@ func (a *Applier) Commit(ctx context.Context, tmpl *github.Commit, header *gitdi
262262
c.Message = github.String("Apply patch with patch2pr")
263263
}
264264

265-
commit, _, err := a.client.Git.CreateCommit(ctx, a.owner, a.repo, &c, nil)
265+
commit, _, err := a.client.Git.CreateCommit(ctx, a.owner, a.repo, c, nil)
266266
if err != nil {
267267
return nil, err
268268
}

applier_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
"github.com/bluekeyes/go-gitdiff/gitdiff"
1717
"github.com/bluekeyes/patch2pr/internal"
18-
"github.com/google/go-github/v74/github"
18+
"github.com/google/go-github/v75/github"
1919
"github.com/shurcooL/githubv4"
2020
)
2121

@@ -279,7 +279,7 @@ func createBranch(t *testing.T, tctx *TestContext) {
279279

280280
if strings.HasSuffix(d.Name(), ".bin") {
281281
c := base64.StdEncoding.EncodeToString(content)
282-
blob, _, err := tctx.Client.Git.CreateBlob(tctx, tctx.Repo.Owner, tctx.Repo.Name, &github.Blob{
282+
blob, _, err := tctx.Client.Git.CreateBlob(tctx, tctx.Repo.Owner, tctx.Repo.Name, github.Blob{
283283
Encoding: github.String("base64"),
284284
Content: &c,
285285
})
@@ -308,23 +308,22 @@ func createBranch(t *testing.T, tctx *TestContext) {
308308
t.Fatalf("error getting recursive tree: %v", err)
309309
}
310310

311-
commit := &github.Commit{
311+
commitToCreate := github.Commit{
312312
Message: github.String("Base commit for test"),
313313
Tree: tree,
314314
}
315-
commit, _, err = tctx.Client.Git.CreateCommit(tctx, tctx.Repo.Owner, tctx.Repo.Name, commit, nil)
315+
316+
commit, _, err := tctx.Client.Git.CreateCommit(tctx, tctx.Repo.Owner, tctx.Repo.Name, commitToCreate, nil)
316317
if err != nil {
317318
t.Fatalf("error creating commit: %v", err)
318319
}
319320

320321
tctx.BaseCommit = commit
321322
tctx.BaseTree = fullTree
322323

323-
if _, _, err := tctx.Client.Git.CreateRef(tctx, tctx.Repo.Owner, tctx.Repo.Name, &github.Reference{
324-
Ref: github.String(tctx.Branch(BaseBranch)),
325-
Object: &github.GitObject{
326-
SHA: commit.SHA,
327-
},
324+
if _, _, err := tctx.Client.Git.CreateRef(tctx, tctx.Repo.Owner, tctx.Repo.Name, github.CreateRef{
325+
Ref: tctx.Branch(BaseBranch),
326+
SHA: commit.GetSHA(),
328327
}); err != nil {
329328
t.Fatalf("error creating ref: %v", err)
330329
}

cmd/patch2pr/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"time"
1717

1818
"github.com/bluekeyes/go-gitdiff/gitdiff"
19-
"github.com/google/go-github/v74/github"
19+
"github.com/google/go-github/v75/github"
2020

2121
"github.com/bluekeyes/patch2pr"
2222
"github.com/bluekeyes/patch2pr/internal"

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module github.com/bluekeyes/patch2pr
22

3-
go 1.23.0
3+
go 1.24.0
44

55
require (
66
github.com/bluekeyes/go-gitdiff v0.8.1
7-
github.com/google/go-github/v74 v74.0.0
7+
github.com/google/go-github/v75 v75.0.0
88
github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f
99
)
1010

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ github.com/bluekeyes/go-gitdiff v0.8.1/go.mod h1:WWAk1Mc6EgWarCrPFO+xeYlujPu98Vu
33
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
44
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
55
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
6-
github.com/google/go-github/v74 v74.0.0 h1:yZcddTUn8DPbj11GxnMrNiAnXH14gNs559AsUpNpPgM=
7-
github.com/google/go-github/v74 v74.0.0/go.mod h1:ubn/YdyftV80VPSI26nSJvaEsTOnsjrxG3o9kJhcyak=
6+
github.com/google/go-github/v75 v75.0.0 h1:k7q8Bvg+W5KxRl9Tjq16a9XEgVY1pwuiG5sIL7435Ic=
7+
github.com/google/go-github/v75 v75.0.0/go.mod h1:H3LUJEA1TCrzuUqtdAQniBNwuKiQIqdGKgBo1/M/uqI=
88
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
99
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
1010
github.com/shurcooL/githubv4 v0.0.0-20210922025249-6831e00d857f h1:q4b8/GCL8Ksl+okhFKSd8DVBQNc0XExjxTO68nK0c3Y=

graphql_applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"path"
1212

1313
"github.com/bluekeyes/go-gitdiff/gitdiff"
14-
"github.com/google/go-github/v74/github"
14+
"github.com/google/go-github/v75/github"
1515
"github.com/shurcooL/githubv4"
1616
)
1717

reference.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66
"strings"
77

8-
"github.com/google/go-github/v74/github"
8+
"github.com/google/go-github/v75/github"
99
)
1010

1111
// Reference is a named reference in a repository.
@@ -48,20 +48,16 @@ func (r *Reference) Set(ctx context.Context, sha string, force bool) error {
4848
}
4949

5050
if exists {
51-
if _, _, err := r.client.Git.UpdateRef(ctx, r.owner, r.repo, &github.Reference{
52-
Ref: github.String(r.ref),
53-
Object: &github.GitObject{
54-
SHA: github.String(sha),
55-
},
56-
}, force); err != nil {
51+
if _, _, err := r.client.Git.UpdateRef(ctx, r.owner, r.repo, r.ref, github.UpdateRef{
52+
SHA: sha,
53+
Force: github.Ptr(force),
54+
}); err != nil {
5755
return fmt.Errorf("update ref failed: %w", err)
5856
}
5957
} else {
60-
if _, _, err := r.client.Git.CreateRef(ctx, r.owner, r.repo, &github.Reference{
61-
Ref: github.String(r.ref),
62-
Object: &github.GitObject{
63-
SHA: github.String(sha),
64-
},
58+
if _, _, err := r.client.Git.CreateRef(ctx, r.owner, r.repo, github.CreateRef{
59+
Ref: r.ref,
60+
SHA: sha,
6561
}); err != nil {
6662
return fmt.Errorf("create ref failed: %w", err)
6763
}

0 commit comments

Comments
 (0)