Skip to content
Snippets Groups Projects
Commit c088a128 authored by Pavel Pletenev's avatar Pavel Pletenev Committed by Christoph Witzko
Browse files

fix: Allow specify job token as token in config

parent 148b9011
No related branches found
No related tags found
No related merge requests found
......@@ -38,15 +38,16 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
token := config["token"]
if token == "" {
token = os.Getenv("GITLAB_TOKEN")
ci_job_token := os.Getenv("CI_JOB_TOKEN")
}
ciJobToken := os.Getenv("CI_JOB_TOKEN")
if token == "" {
if ci_job_token == "" {
if ciJobToken == "" {
return errors.New("gitlab token missing")
}
token = ci_job_token
token = ciJobToken
}
// use the same strategy as goreleaser
if token == ci_job_token {
if token == ciJobToken {
repo.useJobToken = true
if os.Getenv("GIT_STRATEGY") == "none" {
return errors.New("can not use job token with sparse-checkout repository")
......@@ -61,7 +62,7 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
return errors.New("failed to initialize local git repository: " + err.Error())
}
}
}
branch := config["gitlab_branch"]
if branch == "" {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment