Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
provider-gitlab
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
go-semantic-release
provider-gitlab
Commits
148b9011
Commit
148b9011
authored
1 year ago
by
Pavel Pletenev
Committed by
Christoph Witzko
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
feat: Align algorith to aquire tokens with goreleaser
parent
6f581f8b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
pkg/provider/gitlab.go
+20
-19
20 additions, 19 deletions
pkg/provider/gitlab.go
with
20 additions
and
19 deletions
pkg/provider/gitlab.go
+
20
−
19
View file @
148b9011
...
@@ -38,19 +38,19 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
...
@@ -38,19 +38,19 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
token
:=
config
[
"token"
]
token
:=
config
[
"token"
]
if
token
==
""
{
if
token
==
""
{
token
=
os
.
Getenv
(
"GITLAB_TOKEN"
)
token
=
os
.
Getenv
(
"GITLAB_TOKEN"
)
}
ci_job_token
:=
os
.
Getenv
(
"CI_JOB_TOKEN"
)
if
token
==
""
{
token
=
os
.
Getenv
(
"CI_JOB_TOKEN"
)
repo
.
useJobToken
=
true
if
token
==
""
{
if
token
==
""
{
if
ci_job_token
==
""
{
return
errors
.
New
(
"gitlab token missing"
)
return
errors
.
New
(
"gitlab token missing"
)
}
}
token
=
ci_job_token
}
// use the same strategy as goreleaser
if
token
==
ci_job_token
{
repo
.
useJobToken
=
true
if
os
.
Getenv
(
"GIT_STRATEGY"
)
==
"none"
{
if
os
.
Getenv
(
"GIT_STRATEGY"
)
==
"none"
{
return
errors
.
New
(
"can not use job token with sparse-checkout repository"
)
return
errors
.
New
(
"can not use job token with sparse-checkout repository"
)
}
}
repo
.
localRepo
=
&
GitProvider
.
Repository
{}
repo
.
localRepo
=
&
GitProvider
.
Repository
{}
err
:=
repo
.
localRepo
.
Init
(
map
[
string
]
string
{
err
:=
repo
.
localRepo
.
Init
(
map
[
string
]
string
{
"remote_name"
:
"origin"
,
"remote_name"
:
"origin"
,
...
@@ -61,6 +61,7 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
...
@@ -61,6 +61,7 @@ func (repo *GitLabRepository) Init(config map[string]string) error {
return
errors
.
New
(
"failed to initialize local git repository: "
+
err
.
Error
())
return
errors
.
New
(
"failed to initialize local git repository: "
+
err
.
Error
())
}
}
}
}
}
branch
:=
config
[
"gitlab_branch"
]
branch
:=
config
[
"gitlab_branch"
]
if
branch
==
""
{
if
branch
==
""
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment