fix: use github auth token for pulling a repository (#693)
Co-Authored-By: Markus Wolf <markus.wolf@new-work.se> Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
This commit is contained in:
parent
29ea8cfc4e
commit
60b9606fc6
|
@ -361,9 +361,17 @@ func NewGitCloneExecutor(input NewGitCloneExecutorInput) Executor {
|
|||
}
|
||||
}
|
||||
|
||||
if err = w.Pull(&git.PullOptions{
|
||||
pullOptions := git.PullOptions{
|
||||
Force: true,
|
||||
}); err != nil && err.Error() != "already up-to-date" {
|
||||
}
|
||||
if input.Token != "" {
|
||||
pullOptions.Auth = &http.BasicAuth{
|
||||
Username: "token",
|
||||
Password: input.Token,
|
||||
}
|
||||
}
|
||||
|
||||
if err = w.Pull(&pullOptions); err != nil && err.Error() != "already up-to-date" {
|
||||
logger.Debugf("Unable to pull %s: %v", refName, err)
|
||||
}
|
||||
logger.Debugf("Cloned %s to %s", input.URL, input.Dir)
|
||||
|
|
Loading…
Reference in New Issue