Skip to content

Commit

Permalink
Merge 9d0cf7f into 1b4b694
Browse files Browse the repository at this point in the history
  • Loading branch information
k1LoW authored May 11, 2023
2 parents 1b4b694 + 9d0cf7f commit 05dcf95
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 61 deletions.
10 changes: 5 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,18 @@ func Execute() {
}

func setLogger(verbose bool) {
logger := slog.New(slog.NewTextHandler(io.Discard))
logger := slog.New(slog.NewTextHandler(io.Discard, nil))
switch {
case os.Getenv("DEBUG") != "" || os.Getenv("ACTIONS_STEP_DEBUG") != "":
logger = slog.New(slog.HandlerOptions{
logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
AddSource: true,
Level: slog.LevelDebug,
}.NewTextHandler(os.Stderr))
}))
case verbose:
logger = slog.New(slog.HandlerOptions{
logger = slog.New(slog.NewTextHandler(os.Stderr, &slog.HandlerOptions{
AddSource: false,
Level: slog.LevelInfo,
}.NewTextHandler(os.Stderr))
}))
}
slog.SetDefault(logger)
}
Expand Down
9 changes: 4 additions & 5 deletions gh/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import (
"strings"
"time"

"github.com/cli/go-gh"
"github.com/cli/go-gh/pkg/api"
"github.com/google/go-github/v50/github"
"github.com/k1LoW/go-github-client/v50/factory"
"github.com/cli/go-gh/v2/pkg/api"
"github.com/google/go-github/v52/github"
"github.com/k1LoW/go-github-client/v52/factory"
"golang.org/x/exp/slog"
)

Expand Down Expand Up @@ -54,7 +53,7 @@ func newClient(ctx context.Context, owner, repo string) (*client, error) {
slog.Info("Authentication failed, access without credentials", slog.String("endpoint", v3ep), slog.String("owner", owner), slog.String("repo", repo))
return newNoAuthClient(ctx, owner, repo, v3ep)
}
hc, err := gh.HTTPClient(&api.ClientOptions{})
hc, err := api.DefaultHTTPClient()
if err != nil {
return nil, err
}
Expand Down
17 changes: 8 additions & 9 deletions gh/gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import (
"testing/fstest"
"time"

"github.com/cli/go-gh"
"github.com/cli/go-gh/pkg/repository"
"github.com/cli/go-gh/v2/pkg/repository"
"github.com/nlepage/go-tarfs"
"golang.org/x/exp/slog"
)
Expand Down Expand Up @@ -86,21 +85,21 @@ func GetReleaseAsset(ctx context.Context, owner, repo string, opt *AssetOption)
func DetectHostOwnerRepo(ownerrepo string) (string, string, string, error) {
var host, owner, repo string
if ownerrepo == "" {
r, err := gh.CurrentRepository()
r, err := repository.Current()
if err != nil {
return "", "", "", err
}
host = r.Host()
owner = r.Owner()
repo = r.Name()
host = r.Host
owner = r.Owner
repo = r.Name
} else {
r, err := repository.Parse(ownerrepo)
if err != nil {
return "", "", "", err
}
host = r.Host()
owner = r.Owner()
repo = r.Name()
host = r.Host
owner = r.Owner
repo = r.Name
}
return host, owner, repo, nil
}
Expand Down
2 changes: 1 addition & 1 deletion gh/gh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"os"
"testing"

"github.com/k1LoW/go-github-client/v50/factory"
"github.com/k1LoW/go-github-client/v52/factory"
)

func TestMain(m *testing.M) {
Expand Down
32 changes: 18 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,41 @@ module github.com/k1LoW/gh-setup
go 1.20

require (
github.com/cli/go-gh v1.2.1
github.com/cli/go-gh/v2 v2.0.0
github.com/google/go-cmp v0.5.9
github.com/google/go-github/v50 v50.1.0
github.com/google/go-github/v52 v52.0.0
github.com/h2non/filetype v1.1.3
github.com/k1LoW/go-github-client/v50 v50.1.9
github.com/k1LoW/go-github-client/v52 v52.0.10
github.com/nlepage/go-tarfs v1.1.0
github.com/spf13/cobra v1.6.1
golang.org/x/exp v0.0.0-20230307190834-24139beb5833
github.com/spf13/cobra v1.7.0
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea
)

require (
github.com/bradleyfalzon/ghinstallation/v2 v2.2.0 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/bradleyfalzon/ghinstallation/v2 v2.4.0 // indirect
github.com/cli/safeexec v1.0.0 // indirect
github.com/cli/shurcooL-graphql v0.0.2 // indirect
github.com/cli/shurcooL-graphql v0.0.3 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/henvic/httpretty v0.0.6 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/muesli/termenv v0.12.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/thlib/go-timezone-local v0.0.0-20210907160436-ef149e42d28e // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 05dcf95

Please sign in to comment.