@@ -267,7 +267,8 @@ jobs:
267267 # - PR builds pass the branch name in as release_ref, so massage it if it is missing a semver prefix.
268268 echo "Branch (PR) build detected, sanitizing release tag..."
269269 LAST_SEMVER_TAG=$(git describe --tags --match 'v*.*.*' --abbrev=0 | cut -d"-" -f1)
270- RELEASE_REF="${LAST_SEMVER_TAG}-<< parameters.release_ref >>"
270+ BRANCH_NAME=$(echo "<< parameters.release_ref >>" | sed 's/\//-/g')
271+ RELEASE_REF="${LAST_SEMVER_TAG}-${BRANCH_NAME}"
271272 fi
272273 echo "Will use RELEASE_REF=${RELEASE_REF}"
273274 echo "export RELEASE_REF=${RELEASE_REF}" >> $BASH_ENV
@@ -386,18 +387,24 @@ jobs:
386387 command : |
387388 # TODO: once CircleCI updates its pipeline-invocation API, move off of Cheng's personal CircleCI access token, which is saved to both of the slackapi CircleCI "contexts" as an env var:
388389 # https://app.circleci.com/settings/organization/github/slackapi/contexts
390+ if [[ -z "$CIRCLE_BRANCH" || "$CIRCLE_BRANCH" == pull/* ]]; then
391+ BRANCH_NAME="main"
392+ echo "Performing the standard end-to-end test suite for changes of a forked branch"
393+ else
394+ BRANCH_NAME="$CIRCLE_BRANCH"
395+ fi
389396 TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
390397 --header 'Content-Type: application/json' \
391398 -u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
392- --data "{\"branch\":\"${CIRCLE_BRANCH }\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
399+ --data "{\"branch\":\"${BRANCH_NAME }\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
393400 if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
394401 echo "Performing the standard test suite found on the \"main\" branch of the end-to-end tests"
395402 TEST_JOB_WORKFLOW_ID=$(curl --location --request POST 'https://circleci.com/api/v2/project/gh/slackapi/platform-devxp-test/pipeline' \
396403 --header 'Content-Type: application/json' \
397404 -u "${CCHEN_CIRCLECI_PERSONAL_TOKEN}:" \
398405 --data "{\"branch\":\"main\",\"parameters\":{\"slack_cli_build_tag\":\"${RELEASE_REF}\"}}" | jq '.id')
399406 else
400- echo "Performing the changed tests on the \"$CIRCLE_BRANCH \" branch of the end-to-end tests"
407+ echo "Performing the changed tests on the \"$BRANCH_NAME \" branch of the end-to-end tests"
401408 fi
402409 if [ $TEST_JOB_WORKFLOW_ID = "null" ]; then
403410 echo "Failed to start the testing workflow"
0 commit comments