Skip to content

Commit

Permalink
support cloning gitlab's CI_JOB_TOKEN
Browse files Browse the repository at this point in the history
Gitlab CI runs have a $CI_JOB_TOKEN (https://docs.gitlab.com/ee/ci/jobs/ci_job_token.html)
which needs a different username vs using personal token, which can reuse the format used
for github's auth

This adds behavior to make use of it when a new `GitlabCIJobToken` envvar is defined
  • Loading branch information
saucoide committed Jun 11, 2024
1 parent 3ce1085 commit e4d903b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions mkdocs_multirepo_plugin/scripts/sparse_clone.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ if [[ -n "$AccessToken" ]]; then
git config http.extraheader "AUTHORIZATION: bearer $AccessToken"
elif [[ -n "$GithubAccessToken" ]]; then
url_to_use="${protocol}://x-access-token:$GithubAccessToken@$url_rest"
elif [[ -n "$GitlabCIJobToken" ]]; then
url_to_use="${protocol}://gitlab-ci-token:$GitlabCIJobToken@$url_rest"
else
url_to_use="$url"
fi
Expand Down
2 changes: 2 additions & 0 deletions mkdocs_multirepo_plugin/scripts/sparse_clone_old.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ if [[ -n "$AccessToken" ]]; then
git config http.extraheader "AUTHORIZATION: bearer $AccessToken"
elif [[ -n "$GithubAccessToken" ]]; then
url_to_use="${protocol}://x-access-token:$GithubAccessToken@$url_rest"
elif [[ -n "$GitlabCIJobToken" ]]; then
url_to_use="${protocol}://gitlab-ci-token:$GitlabCIJobToken@$url_rest"
else
url_to_use="$url"
fi
Expand Down

0 comments on commit e4d903b

Please sign in to comment.