Skip to content

Commit

Permalink
fix: use github auth token for pulling a repository (#693)
Browse files Browse the repository at this point in the history
Co-Authored-By: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
  • Loading branch information
ZauberNerd and KnisterPeter authored May 19, 2021
1 parent 29ea8cf commit 60b9606
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions pkg/common/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 60b9606

Please sign in to comment.