diff --git a/setup-github-mirror.sh b/setup-github-mirror.sh index 397e72314a2f0f219ec90b026f976b99447ff586..2f418f49765164d0b8c7fefdbcb1b96f67e9a345 100755 --- a/setup-github-mirror.sh +++ b/setup-github-mirror.sh @@ -16,6 +16,10 @@ EOF fi REPO_SLUG="$1" +if grep 'https://github.com/' <<< "$REPO_SLUG"; then + REPO_SLUG="$(sed -Ee 's/^https:\/\/github\.com\/([^/]+\/[^/]+).*/\1/' <<< "$REPO_SLUG")" +fi + # Load configs SCRIPT_DIR=$(dirname $0) @@ -133,4 +137,3 @@ curl --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \ "${GITLAB_URL}/api/v4/projects/${GITLAB_PROJECT_ID}/deploy_keys/${MIRROR_KEY_ID}" > /dev/null echo "./mirror.sh 'https://github.com/${REPO_SLUG}.git' '${GITLAB_PROJECT_URL}'" -