Skip to content

Commit f3d8b68

Browse files
authored
Merge pull request #320 from fluxcd/upgrade-github-go
Upgrade go-github to 75.0.0
2 parents 18dd6a2 + 5c193bf commit f3d8b68

22 files changed

+35
-35
lines changed

github/auth.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package github
1919
import (
2020
"fmt"
2121

22-
"github.com/google/go-github/v72/github"
22+
"github.com/google/go-github/v75/github"
2323

2424
"github.com/fluxcd/go-git-providers/gitprovider"
2525
)

github/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"strings"
2222

23-
"github.com/google/go-github/v72/github"
23+
"github.com/google/go-github/v75/github"
2424

2525
"github.com/fluxcd/go-git-providers/gitprovider"
2626
)

github/client_organization_teams.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package github
1919
import (
2020
"context"
2121

22-
"github.com/google/go-github/v72/github"
22+
"github.com/google/go-github/v75/github"
2323

2424
"github.com/fluxcd/go-git-providers/gitprovider"
2525
)

github/client_repositories_org.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"errors"
2222

23-
"github.com/google/go-github/v72/github"
23+
"github.com/google/go-github/v75/github"
2424

2525
"github.com/fluxcd/go-git-providers/gitprovider"
2626
)

github/client_repository_branch.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package github
1919
import (
2020
"context"
2121

22-
"github.com/google/go-github/v72/github"
22+
"github.com/google/go-github/v75/github"
2323

2424
"github.com/fluxcd/go-git-providers/gitprovider"
2525
)
@@ -38,11 +38,9 @@ func (c *BranchClient) Create(ctx context.Context, branch, sha string) error {
3838

3939
ref := "refs/heads/" + branch
4040

41-
reference := &github.Reference{
42-
Ref: &ref,
43-
Object: &github.GitObject{
44-
SHA: &sha,
45-
},
41+
reference := github.CreateRef{
42+
Ref: ref,
43+
SHA: sha,
4644
}
4745

4846
if _, _, err := c.c.Client().Git.CreateRef(ctx, c.ref.GetIdentity(), c.ref.GetRepository(), reference); err != nil {

github/client_repository_commit.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
"fmt"
2222

2323
"github.com/fluxcd/go-git-providers/gitprovider"
24-
"github.com/google/go-github/v72/github"
24+
"github.com/google/go-github/v75/github"
2525
)
2626

2727
var githubNewFileMode = "100644"
@@ -98,7 +98,7 @@ func (c *CommitClient) Create(ctx context.Context, branch string, message string
9898
}
9999

100100
latestCommitSHA := commits[0].Get().Sha
101-
nCommit, _, err := c.c.Client().Git.CreateCommit(ctx, c.ref.GetIdentity(), c.ref.GetRepository(), &github.Commit{
101+
nCommit, _, err := c.c.Client().Git.CreateCommit(ctx, c.ref.GetIdentity(), c.ref.GetRepository(), github.Commit{
102102
Message: &message,
103103
Tree: tree,
104104
Parents: []*github.Commit{
@@ -110,16 +110,18 @@ func (c *CommitClient) Create(ctx context.Context, branch string, message string
110110
if err != nil {
111111
return nil, err
112112
}
113+
if nCommit.SHA == nil {
114+
// The UpdateRef API requires a SHA.
115+
return nil, fmt.Errorf("created commit has no SHA")
116+
}
113117

114118
ref := "refs/heads/" + branch
115-
ghRef := &github.Reference{
116-
Ref: &ref,
117-
Object: &github.GitObject{
118-
SHA: nCommit.SHA,
119-
},
119+
updateRef := github.UpdateRef{
120+
SHA: *nCommit.SHA,
121+
Force: github.Ptr(true),
120122
}
121123

122-
if _, _, err := c.c.Client().Git.UpdateRef(ctx, c.ref.GetIdentity(), c.ref.GetRepository(), ghRef, true); err != nil {
124+
if _, _, err := c.c.Client().Git.UpdateRef(ctx, c.ref.GetIdentity(), c.ref.GetRepository(), ref, updateRef); err != nil {
123125
return nil, err
124126
}
125127

github/client_repository_deploykey.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121
"errors"
2222

23-
"github.com/google/go-github/v72/github"
23+
"github.com/google/go-github/v75/github"
2424

2525
"github.com/fluxcd/go-git-providers/gitprovider"
2626
)

github/client_repository_file.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import (
2323
"io"
2424

2525
"github.com/fluxcd/go-git-providers/gitprovider"
26-
"github.com/google/go-github/v72/github"
26+
"github.com/google/go-github/v75/github"
2727
)
2828

2929
// FileClient implements the gitprovider.FileClient interface.

github/client_repository_pullrequest.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"context"
2121

2222
"github.com/fluxcd/go-git-providers/gitprovider"
23-
"github.com/google/go-github/v72/github"
23+
"github.com/google/go-github/v75/github"
2424
)
2525

2626
// PullRequestClient implements the gitprovider.PullRequestClient interface.

github/example_organization_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/fluxcd/go-git-providers/github"
99
"github.com/fluxcd/go-git-providers/gitprovider"
10-
gogithub "github.com/google/go-github/v72/github"
10+
gogithub "github.com/google/go-github/v75/github"
1111
)
1212

1313
// checkErr is used for examples in this repository.

0 commit comments

Comments
 (0)