diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 0b8b1dc6e5..a06d9fbcaf 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -62,9 +62,12 @@ if [[ "${ACTION}" =~ "upgrade" ]]; then # Set the source branch for upgrade tests # Be sure to change this whenever a new stable branch # is created. + # The branch prefix will also change from 'stable/' to 'unmaintained/' + # in the future, so determine the branch prefix dynamically UPGRADE_ACTION_ARRAY=(${ACTION//_/ }) export UPGRADE_SOURCE_RELEASE=${UPGRADE_ACTION_ARRAY[1]:-'2023.2'} - export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-stable/$UPGRADE_SOURCE_RELEASE} + export UPGRADE_SOURCE_BRANCH_PREFIX=$(git branch -r --list 'origin/*' | grep $UPGRADE_SOURCE_RELEASE | sort | tail -n 1 | cut -d '/' -f 2) + export UPGRADE_SOURCE_BRANCH=${UPGRADE_SOURCE_BRANCH:-$UPGRADE_SOURCE_BRANCH_PREFIX/$UPGRADE_SOURCE_RELEASE} # Store the target SHA/branch export UPGRADE_TARGET_BRANCH=$(git rev-parse HEAD)