diff --git a/go.mod b/go.mod index 0f5ad99..8bf10e9 100644 --- a/go.mod +++ b/go.mod @@ -6,13 +6,12 @@ toolchain go1.26.4 require ( github.com/bradleyfalzon/ghinstallation/v2 v2.19.0 - github.com/google/go-github/v85 v85.0.0 + github.com/google/go-github/v88 v88.0.0 github.com/k0kubun/pp/v3 v3.5.1 ) require ( github.com/golang-jwt/jwt/v4 v4.5.2 // indirect - github.com/google/go-github/v88 v88.0.0 // indirect github.com/google/go-querystring v1.2.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect diff --git a/go.sum b/go.sum index b182d10..5b0c6ce 100644 --- a/go.sum +++ b/go.sum @@ -5,8 +5,6 @@ github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w 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= diff --git a/main.go b/main.go index eb8aad7..1f9a97a 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( "time" "github.com/bradleyfalzon/ghinstallation/v2" - "github.com/google/go-github/v85/github" + "github.com/google/go-github/v88/github" "github.com/k0kubun/pp/v3" ) @@ -102,20 +102,25 @@ func showExport(token string) { } func showInstallations(appID int64, key []byte, githubURL string) { - atr, err := ghinstallation.NewAppsTransport(http.DefaultTransport, appID, key) - if err != nil { - log.Fatal(err) + atr, ghierr := ghinstallation.NewAppsTransport(http.DefaultTransport, appID, key) + if ghierr != nil { + log.Fatal(ghierr) } - var client *github.Client + var ( + client *github.Client + err error + ) + if githubURL != "" { atr.BaseURL = githubURL - client, err = github.NewEnterpriseClient(githubURL, githubURL, &http.Client{Transport: atr}) - if err != nil { - log.Fatalf("failed creating enterprise client: %v", err) - } + client, err = github.NewClient(github.WithEnterpriseURLs(githubURL, githubURL), github.WithTransport(atr)) } else { - client = github.NewClient(&http.Client{Transport: atr}) + client, err = github.NewClient(github.WithTransport(atr)) + } + + if err != nil { + log.Fatalf("failed creating the client: %v", err) } opts := &github.ListOptions{