From 5f6836542dbdecba0089908ba3b6a9bda76e7c5d Mon Sep 17 00:00:00 2001 From: "Zhefeng C." <38037704+catbro666@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:09:30 +0800 Subject: [PATCH] chore(ci): change to use the starting point of the previous branch for old plugin compatibility test (#13536) When a new minor version is just bumped, the tag x.x.0 doesn't exist yet. So we change it to use the starting point of the previous branch instead of the tag x.x.0 of the previous branch. --- .github/workflows/build_and_test.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 6421ae583af..7293ba77efd 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -51,11 +51,18 @@ jobs: KONG_VERSION=$(bash scripts/grep-kong-version.sh) major=$(echo "$KONG_VERSION" | cut -d. -f1) minor=$(echo "$KONG_VERSION" | cut -d. -f2) - # if the minor version isn't 0, use the first release of the previous minor version; + # if the minor version isn't 0, use the first release or starting point of the previous minor branch; # otherwise just leave it empty, so later the default branch or commit will be used. if [ "$minor" -ne 0 ]; then minor=$((minor - 1)) - echo "ref=$major.$minor.0" >> $GITHUB_OUTPUT + git fetch origin master -t + if [ $(git tag -l "$major.$minor.0") ]; then + echo "ref=$major.$minor.0" >> $GITHUB_OUTPUT + else + git fetch origin release/$major.$minor.x + COMMIT_HASH=$(git merge-base origin/master origin/release/$major.$minor.x) + echo "ref=$COMMIT_HASH" >> $GITHUB_OUTPUT + fi else echo "ref=" >> $GITHUB_OUTPUT fi