Skip to content

Commit

Permalink
Merge pull request #40 from tomtwinkle/fix/git-clone-use-token
Browse files Browse the repository at this point in the history
fix: git clone use token
  • Loading branch information
tomtwinkle authored Aug 16, 2023
2 parents a54f876 + 05bbb6b commit 63664f4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/pkg/gh/gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"strings"
"time"

"github.com/go-git/go-git/v5/plumbing/transport/http"

"github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
Expand Down Expand Up @@ -68,6 +70,9 @@ func New(ctx context.Context, token string, logger *slog.Logger) (Github, error)

func NewWithConfig(ctx context.Context, token string, remoteConfig RemoteConfig) (Github, error) {
r, err := git.CloneContext(ctx, memory.NewStorage(), nil, &git.CloneOptions{
Auth: &http.TokenAuth{
Token: token,
},
URL: fmt.Sprintf("https://github.com/%s/%s", remoteConfig.Owner, remoteConfig.Repo),
})
if err != nil {
Expand Down

0 comments on commit 63664f4

Please sign in to comment.