4848
4949 echo "::endgroup::"
5050
51+ has_backport_label=false
5152 has_skip_backport_label=false
52- has_exact_backport_label=false
5353 declare -A pr_exact_majors=()
5454 declare -A pr_floating_majors=()
5555
@@ -66,12 +66,13 @@ jobs:
6666 continue
6767 fi
6868
69+ has_backport_label=true
70+
6971 if [[ "${pr_label}" =~ ${backport_regex} ]]; then
7072 major="${BASH_REMATCH[1]}"
7173 minor="${BASH_REMATCH[2]}"
7274 if [ "${minor}" != "x" ]; then
7375 pr_exact_majors["${major}"]=1
74- has_exact_backport_label=true
7576 else
7677 pr_floating_majors["${major}"]=1
7778 fi
@@ -82,15 +83,15 @@ jobs:
8283
8384 echo "::endgroup::"
8485
85- if [ "${has_skip_backport_label}" = true ] && [ "${has_exact_backport_label }" = true ]; then
86+ if [ "${has_skip_backport_label}" = true ] && [ "${has_backport_label }" = true ]; then
8687 echo "::error::The 'skip-backport' not be used in combination with another backport"\
8788 "label."
8889 exit 1
8990 fi
9091
91- if [ "${has_skip_backport_label}" != true ] && [ "${has_exact_backport_label }" != true ]; then
92- echo "::error::No exact backport label found. Please add at least one of the"\
93- "'backport {major}.{minor}' labels or use 'skip-backport',"\
92+ if [ "${has_skip_backport_label}" != true ] && [ "${has_backport_label }" != true ]; then
93+ echo "::error::No backport label found. Please add at least one of the"\
94+ "'backport {major}.{minor|x }' labels or use 'skip-backport',"\
9495 "if this PR should not be backported."
9596 exit 1
9697 fi
@@ -115,19 +116,3 @@ jobs:
115116 if [ "${has_required_floating_labels}" != true ]; then
116117 exit 1
117118 fi
118-
119- # Validate that an exact backport label exists for each floating backport label major
120- # version.
121-
122- has_required_exact_labels=true
123-
124- for pr_floating_major in "${!pr_floating_majors[@]}"; do
125- if [ -z "${pr_exact_majors[${pr_floating_major}]}" ]; then
126- has_required_exact_labels=false
127- echo "::error::Missing exact backport label for '${pr_floating_major}.x'"
128- fi
129- done
130-
131- if [ "${has_required_exact_labels}" != true ]; then
132- exit 1
133- fi
0 commit comments