Skip to content
Snippets Groups Projects
Verified Commit 438bf882 authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

Make `setup-github-mirror.sh` URL aware

Previously one had to manually take the repository slug from the URL in
order to set up a github mirror. This patch makes the script aware of
the slug's position in the github URL and will grab it from there.
parent 68ef983c
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,10 @@ EOF ...@@ -16,6 +16,10 @@ EOF
fi fi
REPO_SLUG="$1" 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 # Load configs
SCRIPT_DIR=$(dirname $0) SCRIPT_DIR=$(dirname $0)
...@@ -133,4 +137,3 @@ curl --header "PRIVATE-TOKEN: ${ACCESS_TOKEN}" \ ...@@ -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 "${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}'" echo "./mirror.sh 'https://github.com/${REPO_SLUG}.git' '${GITLAB_PROJECT_URL}'"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment