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
2 changes: 1 addition & 1 deletion applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"time"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v85/github"
"github.com/google/go-github/v88/github"
)

// DefaultCommitMessage is the commit message used when no message is provided
Expand Down
9 changes: 7 additions & 2 deletions applier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/bluekeyes/patch2pr/internal"
"github.com/google/go-github/v85/github"
"github.com/google/go-github/v88/github"
"github.com/shurcooL/githubv4"
)

Expand Down Expand Up @@ -238,11 +238,16 @@ func prepareTestContext(t *testing.T) *TestContext {
ctx := context.Background()
httpClient := internal.NewTokenClient(token)

client, err := github.NewClient(github.WithHTTPClient(httpClient))
if err != nil {
t.Fatalf("Error creating GitHub client: %v", err)
}

tctx := TestContext{
Context: ctx,
ID: id,
Repo: repo,
Client: github.NewClient(httpClient),
Client: client,
V4Client: githubv4.NewClient(httpClient),
}
return &tctx
Expand Down
20 changes: 11 additions & 9 deletions cmd/patch2pr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ import (
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
"strings"
"time"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v85/github"
"github.com/google/go-github/v88/github"

"github.com/bluekeyes/patch2pr"
"github.com/bluekeyes/patch2pr/internal"
Expand Down Expand Up @@ -56,14 +55,12 @@ type Options struct {
PullTitle string
Repository *patch2pr.Repository
GitHubToken string
GitHubURL *url.URL
GitHubURL string
PullBody string
}

func main() {
opts := Options{
GitHubURL: &url.URL{Scheme: "https", Host: "api.github.com", Path: "/"},
}
var opts Options

fs := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
fs.SetOutput(ioutil.Discard)
Expand All @@ -83,7 +80,7 @@ func main() {
fs.StringVar(&opts.PullTitle, "pull-title", "", "pull-title")
fs.Var(RepositoryValue{&opts.Repository}, "repository", "repository")
fs.StringVar(&opts.GitHubToken, "token", "", "token")
fs.Var(URLValue{&opts.GitHubURL}, "url", "url")
fs.StringVar(&opts.GitHubURL, "url", "https://api.github.com/", "url")

var printVersion bool
fs.BoolVar(&printVersion, "v", false, "version")
Expand Down Expand Up @@ -116,8 +113,13 @@ func main() {
ctx := context.Background()
tc := internal.NewTokenClient(opts.GitHubToken)

client := github.NewClient(tc)
client.BaseURL = opts.GitHubURL
client, err := github.NewClient(
github.WithHTTPClient(tc),
github.WithURLs(&opts.GitHubURL, nil),
)
if err != nil {
die(1, fmt.Errorf("creating GitHub client failed: %w", err))
}

var patchFiles []string
if fs.NArg() == 0 {
Expand Down
26 changes: 0 additions & 26 deletions cmd/patch2pr/values.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
package main

import (
"net/url"
"strings"

"github.com/bluekeyes/patch2pr"
)

Expand All @@ -27,29 +24,6 @@ func (v RepositoryValue) Set(s string) error {
return nil
}

type URLValue struct {
u **url.URL
}

func (v URLValue) String() string {
if v.u == nil || *v.u == nil {
return ""
}
return (*v.u).String()
}

func (v URLValue) Set(s string) error {
u, err := url.Parse(s)
if err != nil {
return err
}
if !strings.HasSuffix(u.Path, "/") {
u.Path += "/"
}
*v.u = u
return nil
}

type ForkValue struct {
RepositoryValue
enabled *bool
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.25.0

require (
github.com/bluekeyes/go-gitdiff v0.8.1
github.com/google/go-github/v85 v85.0.0
github.com/google/go-github/v88 v88.0.0
github.com/shurcooL/githubv4 v0.0.0-20260209031235-2402fdf4a9ed
)

Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ github.com/bluekeyes/go-gitdiff v0.8.1/go.mod h1:WWAk1Mc6EgWarCrPFO+xeYlujPu98Vu
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
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/v85 v85.0.0 h1:1+TLFX/akTFXK7o9Z9uAloQGufOn4ySa5DItUM1VWT4=
github.com/google/go-github/v85 v85.0.0/go.mod h1:jYkBnqN+SzR2A2fGKYfbt6DEEQAyxeK0Q2XpPV9ZFsU=
github.com/google/go-github/v88 v88.0.0 h1:dZA9IKkPK1eXZj4ypngnpRj5FwdpTv4whix2PrQMP7M=
github.com/google/go-github/v88 v88.0.0/go.mod h1:rufTDgn2N45wjhukLTyxmvc9nilSp3mr3Rgtt6b1MPw=
github.com/google/go-querystring v1.2.0 h1:yhqkPbu2/OH+V9BfpCVPZkNmUXhb2gBxJArfhIxNtP0=
github.com/google/go-querystring v1.2.0/go.mod h1:8IFJqpSRITyJ8QhQ13bmbeMBDfmeEJZD5A0egEOmkqU=
github.com/shurcooL/githubv4 v0.0.0-20260209031235-2402fdf4a9ed h1:KT7hI8vYXgU0s2qaMkrfq9tCA1w/iEPgfredVP+4Tzw=
Expand Down
2 changes: 1 addition & 1 deletion graphql_applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"path"

"github.com/bluekeyes/go-gitdiff/gitdiff"
"github.com/google/go-github/v85/github"
"github.com/google/go-github/v88/github"
"github.com/shurcooL/githubv4"
)

Expand Down
2 changes: 1 addition & 1 deletion reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/google/go-github/v85/github"
"github.com/google/go-github/v88/github"
)

// Reference is a named reference in a repository.
Expand Down
Loading