Skip to content

Commit df7f275

Browse files
authored
Merge pull request #48195 from thaJeztah/27.1_backport_fix_pr_title_check
[27.1 backport] gha: check-pr-branch: fix branch check regression
2 parents fb3ec9f + 1c0885d commit df7f275

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

.github/workflows/validate-pr.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ jobs:
5757
id: title_branch
5858
run: |
5959
# get the intended major version prefix ("[27.1 backport]" -> "27.") from the PR title.
60-
[[ "$PR_TITLE" =~ ^\[\([0-9]*\.\)[^]]*\] ]] && branch="${BASH_REMATCH[1]}"
60+
[[ "$PR_TITLE" =~ ^\[([0-9]*\.)[^]]*\] ]] && branch="${BASH_REMATCH[1]}"
6161
6262
# get major version prefix from the release branch ("27.x -> "27.")
63-
[[ "$GITHUB_BASE_REF" =~ ^\([0-9]*\.\) ]] && target_branch="${BASH_REMATCH[1]}"
63+
[[ "$GITHUB_BASE_REF" =~ ^([0-9]*\.) ]] && target_branch="${BASH_REMATCH[1]}" || target_branch="$GITHUB_BASE_REF"
6464
65-
if [[ "$GITHUB_BASE_REF" != "$branch" ]] && ! [[ "$GITHUB_BASE_REF" == "master" && "$branch" == "" ]]; then
65+
if [[ "$target_branch" != "$branch" ]] && ! [[ "$GITHUB_BASE_REF" == "master" && "$branch" == "" ]]; then
6666
echo "::error::PR is opened against the $GITHUB_BASE_REF branch, but its title suggests otherwise."
6767
exit 1
6868
fi

0 commit comments

Comments
 (0)