diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index 73323ad6de2f..9110edd3a5a8 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -56,12 +56,16 @@ jobs: - name: Check release branch id: title_branch run: | + set -x + # get the intended major version prefix ("[27.1 backport]" -> "27.") from the PR title. [[ "$PR_TITLE" =~ ^\[\([0-9]*\.\)[^]]*\] ]] && branch="${BASH_REMATCH[1]}" # get major version prefix from the release branch ("27.x -> "27.") [[ "$GITHUB_BASE_REF" =~ ^\([0-9]*\.\) ]] && target_branch="${BASH_REMATCH[1]}" + printenv + if [[ "$GITHUB_BASE_REF" != "$branch" ]] && ! [[ "$GITHUB_BASE_REF" == "master" && "$branch" == "" ]]; then echo "::error::PR is opened against the $GITHUB_BASE_REF branch, but its title suggests otherwise." exit 1