diff --git a/act/common/git.go b/act/common/git.go index 64946e09..233a6b70 100644 --- a/act/common/git.go +++ b/act/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 }