Skip to content

Commit

Permalink
Merge pull request #35 from tomtwinkle/feat/pr-release-use-git-reposi…
Browse files Browse the repository at this point in the history
…tory

feat: pr release use git repository,remote
  • Loading branch information
tomtwinkle authored Aug 15, 2023
2 parents 462b898 + 0206b1e commit 2eba47d
Show file tree
Hide file tree
Showing 9 changed files with 215 additions and 183 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tomtwinkle/go-pr-release

go 1.19
go 1.21

require (
github.com/Masterminds/sprig/v3 v3.2.3
Expand Down
21 changes: 15 additions & 6 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import (
"context"
"errors"
"fmt"
"log/slog"
"os"
"reflect"
"strings"

"github.com/tomtwinkle/go-pr-release/internal/pkg/gh"

"github.com/tomtwinkle/go-pr-release/internal/markdown"

tren "github.com/go-playground/validator/v10/translations/en"

"github.com/go-playground/locales/en"
ut "github.com/go-playground/universal-translator"
"github.com/go-playground/validator/v10"
tren "github.com/go-playground/validator/v10/translations/en"
"github.com/mkideal/cli"

"github.com/tomtwinkle/go-pr-release/internal/markdown"
"github.com/tomtwinkle/go-pr-release/internal/pkg/env"
"github.com/tomtwinkle/go-pr-release/internal/pkg/gh"
)

const (
Expand Down Expand Up @@ -195,9 +195,18 @@ func transFunc(ut ut.Translator, fe validator.FieldError) string {

func MakePR(arg *Args) error {
ctx := context.Background()

logLevel := slog.LevelInfo
if arg.Verbose {
logLevel = slog.LevelDebug
}
logger := slog.New(slog.NewJSONHandler(os.Stdout, &slog.HandlerOptions{
Level: logLevel,
}))
g, err := gh.New(ctx, arg.Token, gh.RemoteConfigParam{
GitDirPath: gitDir,
RemoteName: gitRemoteName,
Logger: logger,
})
if err != nil {
return err
Expand Down
1 change: 0 additions & 1 deletion internal/cli/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"testing"

"github.com/bxcodec/faker/v3"

"github.com/stretchr/testify/assert"

"github.com/tomtwinkle/go-pr-release/internal/cli"
Expand Down
3 changes: 1 addition & 2 deletions internal/markdown/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ import (
"os"
"time"

"github.com/google/go-github/v45/github"

"github.com/Masterminds/sprig/v3"
"github.com/google/go-github/v45/github"
)

const defaultTmpl = `# Releases
Expand Down
1 change: 1 addition & 0 deletions internal/markdown/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/bxcodec/faker/v3"
"github.com/google/go-github/v45/github"
"github.com/stretchr/testify/assert"

"github.com/tomtwinkle/go-pr-release/internal/markdown"
)

Expand Down
1 change: 1 addition & 0 deletions internal/pkg/env/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/bxcodec/faker/v3"
"github.com/stretchr/testify/assert"

"github.com/tomtwinkle/go-pr-release/internal/pkg/env"
)

Expand Down
Loading

0 comments on commit 2eba47d

Please sign in to comment.