diff --git a/pkg/common/git.go b/pkg/common/git.go index 64946e0..233a6b7 100644 --- a/pkg/common/git.go +++ b/pkg/common/git.go @@ -291,9 +291,17 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor { } // fetch latest changes - err = r.Fetch(&git.FetchOptions{ + fetchOptions := git.FetchOptions{ RefSpecs: []config.RefSpec{"refs/*:refs/*", "HEAD:refs/heads/HEAD"}, - }) + } + if input.Token != "" { + fetchOptions.Auth = &http.BasicAuth{ + Username: "token", + Password: input.Token, + } + } + + err = r.Fetch(&fetchOptions) if err != nil && !errors.Is(err, git.NoErrAlreadyUpToDate) { return err }