diff --git a/entrypoint.sh b/entrypoint.sh index cf95ea7..a2f8f8f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -7,7 +7,8 @@ POLL_TIMEOUT=${POLL_TIMEOUT:-$DEFAULT_POLL_TIMEOUT} git checkout "${GITHUB_REF:11}" -branch=${GITHUB_REPOSITORY}/$(git symbolic-ref --short HEAD) +branch="$(git symbolic-ref --short HEAD)" +branch_uri="$(urlencode ${branch})" sh -c "git config --global credential.username $GITLAB_USERNAME" sh -c "git config --global core.askPass /cred-helper.sh" @@ -18,10 +19,7 @@ sh -c "git push mirror $branch" sleep $POLL_TIMEOUT -# convert slashes in a HTML-compatible way -branch=${branch//\//%2F} - -pipeline_id=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${branch}" | jq '.last_pipeline.id') +pipeline_id=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" --silent "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${branch_uri}" | jq '.last_pipeline.id') echo "Triggered CI for branch ${branch}" echo "Working with pipeline id #${pipeline_id}"