Don't append token if already pass is used

This commit is contained in:
Marcin Grzejszczak
2018-12-13 17:41:30 +00:00
committed by GitHub
parent ebbad49f17
commit 12286375b6

View File

@@ -34,10 +34,10 @@ function set_default_props() {
# Adds the oauth token if present to the remote url
function add_oauth_token_to_remote_url() {
if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" ]]; then
remote=`git config remote.origin.url | sed -e 's/^git:/https:/'`
echo "Current remote [${remote}]"
if [[ "${RELEASER_GIT_OAUTH_TOKEN}" != "" && ${remote} != *"@"* ]]; then
echo "OAuth token found. Will reuse it to push the code"
remote=`git config remote.origin.url | sed -e 's/^git:/https:/'`
echo "Current remote [${remote}]"
withToken=${remote/https:\/\//https://${RELEASER_GIT_OAUTH_TOKEN}@}
git remote set-url --push origin "${withToken}"
else