Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.25.0

require (
github.com/goccy/go-yaml v1.19.2
github.com/google/go-github/v60 v60.0.0
github.com/google/go-github/v89 v89.0.0
golang.org/x/oauth2 v0.36.0
)
Expand Down
12 changes: 3 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
github.com/goccy/go-yaml v1.19.2 h1:PmFC1S6h8ljIz6gMRBopkjP1TVT7xuwrButHID66PoM=
github.com/goccy/go-yaml v1.19.2/go.mod h1:XBurs7gK8ATbW4ZPGKgcbrY1Br56PdM69F7LkFRi1kA=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
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-github/v60 v60.0.0 h1:oLG98PsLauFvvu4D/YPxq374jhSxFYdzQGNCyONLfn8=
github.com/google/go-github/v60 v60.0.0/go.mod h1:ByhX2dP9XT9o/ll2yXAu2VD8l5eNVg8hD4Cr0S/LmQk=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/google/go-github/v89 v89.0.0 h1:35bEK5XoEcF3PZrlVbl9XN63f5BcJRA/UGkxeC9xPg0=
github.com/google/go-github/v89 v89.0.0/go.mod h1:QLcbU0ipeAqQuR5KSg8c2lql4Qk1EwJ2dWz/0rP4Nho=
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/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70=
golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
golang.org/x/oauth2 v0.36.0 h1:peZ/1z27fi9hUOFCAZaHyrpWG5lwe0RJEEEeH0ThlIs=
golang.org/x/oauth2 v0.36.0/go.mod h1:YDBUJMTkDnJS+A4BP4eZBjCqtokkg1hODuPjwiGPO7Q=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
8 changes: 6 additions & 2 deletions internal/github/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"os"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v89/github"
"golang.org/x/oauth2"
)

Expand Down Expand Up @@ -69,9 +69,13 @@ func NewClient(ctx context.Context, token string, opts ...ClientOption) (*Client
&oauth2.Token{AccessToken: token},
)
tc := oauth2.NewClient(ctx, ts)
ghClient, err := github.NewClient(github.WithHTTPClient(tc))
if err != nil {
return nil, fmt.Errorf("creating github client: %w", err)
}

c := &Client{
client: github.NewClient(tc),
client: ghClient,
fileReader: &osFileReader{},
}

Expand Down
15 changes: 8 additions & 7 deletions internal/github/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"context"
"fmt"

"github.com/google/go-github/v60/github"
"github.com/google/go-github/v89/github"
)

// CreateReleasePR creates a new branch with the modified files and opens a PR.
Expand All @@ -34,9 +34,9 @@ func (c *Client) CreateReleasePR(ctx context.Context, req PRRequest) (*PRResult,
}

// Create the new branch
newRef := &github.Reference{
Ref: github.String("refs/heads/" + req.HeadBranch),
Object: &github.GitObject{SHA: baseRef.Object.SHA},
newRef := github.CreateRef{
Ref: "refs/heads/" + req.HeadBranch,
SHA: baseRef.GetObject().GetSHA(),
}

_, _, err = c.client.Git.CreateRef(ctx, req.Owner, req.Repo, newRef)
Expand Down Expand Up @@ -133,7 +133,7 @@ func (c *Client) commitFiles(ctx context.Context, owner, repo, branch string, fi

// Create the commit
commit, _, err := c.client.Git.CreateCommit(ctx, owner, repo,
&github.Commit{
github.Commit{
Message: github.String(message),
Tree: tree,
Parents: []*github.Commit{baseCommit},
Expand All @@ -145,8 +145,9 @@ func (c *Client) commitFiles(ctx context.Context, owner, repo, branch string, fi
}

// Update the branch reference to point to the new commit
ref.Object.SHA = commit.SHA
_, _, err = c.client.Git.UpdateRef(ctx, owner, repo, ref, false)
_, _, err = c.client.Git.UpdateRef(ctx, owner, repo, ref.GetRef(), github.UpdateRef{
SHA: commit.GetSHA(),
})
if err != nil {
return fmt.Errorf("updating ref: %w", err)
}
Expand Down
Loading