fix(core): try
This commit is contained in:
@@ -26,16 +26,25 @@ jobs:
|
|||||||
MIRROR_URL: ${{ secrets.MIRROR_REPO_URL }}
|
MIRROR_URL: ${{ secrets.MIRROR_REPO_URL }}
|
||||||
MIRROR_TOKEN: ${{ secrets.MIRROR_REPO_TOKEN }}
|
MIRROR_TOKEN: ${{ secrets.MIRROR_REPO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
|
# URL encode special characters in credentials
|
||||||
|
ENCODED_USER=$(printf %s "$GIT_USER_NAME" | jq -sRr @uri)
|
||||||
|
ENCODED_TOKEN=$(printf %s "$MIRROR_TOKEN" | jq -sRr @uri)
|
||||||
|
|
||||||
# Build authenticated URL
|
# Build authenticated URL
|
||||||
if [[ "$MIRROR_URL" == http* ]]; then
|
if [[ "$MIRROR_URL" == https://* ]]; then
|
||||||
# URL already contains protocol
|
# URL with https protocol
|
||||||
AUTH_URL="${MIRROR_URL/https:\/\//https://$GIT_USER_NAME:$MIRROR_TOKEN@}"
|
CLEAN_URL="${MIRROR_URL#https://}"
|
||||||
AUTH_URL="${AUTH_URL/http:\/\//http://$GIT_USER_NAME:$MIRROR_TOKEN@}"
|
AUTH_URL="https://${ENCODED_USER}:${ENCODED_TOKEN}@${CLEAN_URL}"
|
||||||
|
elif [[ "$MIRROR_URL" == http://* ]]; then
|
||||||
|
# URL with http protocol
|
||||||
|
CLEAN_URL="${MIRROR_URL#http://}"
|
||||||
|
AUTH_URL="http://${ENCODED_USER}:${ENCODED_TOKEN}@${CLEAN_URL}"
|
||||||
else
|
else
|
||||||
# URL without protocol
|
# URL without protocol
|
||||||
AUTH_URL="https://$GIT_USER_NAME:$MIRROR_TOKEN@$MIRROR_URL"
|
AUTH_URL="https://${ENCODED_USER}:${ENCODED_TOKEN}@${MIRROR_URL}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo $AUTH_URL
|
||||||
# Add mirror remote with authentication
|
# Add mirror remote with authentication
|
||||||
git remote add mirror "$AUTH_URL"
|
git remote add mirror "$AUTH_URL"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user