You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
for mod in $MODULE_LABELS $MODULE_EXEMPT_LABELS; do
55
57
if [ "$label" = "$mod" ]; then
56
58
HAS_MODULE=true
57
59
break 2
58
60
fi
59
61
done
60
-
done
62
+
done < <(echo "$LABELS" | jq -r '.[].name')
61
63
62
64
if [ "$HAS_MODULE" = "false" ]; then
63
65
ERRORS="${ERRORS}- **Missing module label**: add at least one of: \`cuda.bindings\`, \`cuda.core\`, \`cuda.pathfinder\` (or a cross-cutting label such as \`CI/CD\`).\n"
@@ -66,14 +68,15 @@ jobs:
66
68
# Type labels categorize the kind of change.
67
69
TYPE_LABELS="bug enhancement feature documentation test example CI/CD packaging dependencies performance experiment RFC support P0 P1 P2"
68
70
HAS_TYPE=false
69
-
for label in $LABEL_NAMES; do
71
+
while IFS= read -r label; do
72
+
[ -n "$label" ] || continue
70
73
for typ in $TYPE_LABELS; do
71
74
if [ "$label" = "$typ" ]; then
72
75
HAS_TYPE=true
73
76
break 2
74
77
fi
75
78
done
76
-
done
79
+
done < <(echo "$LABELS" | jq -r '.[].name')
77
80
78
81
if [ "$HAS_TYPE" = "false" ]; then
79
82
ERRORS="${ERRORS}- **Missing type label**: add at least one of: \`bug\`, \`enhancement\`, \`feature\`, \`documentation\`, \`test\`, \`example\`, \`CI/CD\`, \`packaging\`, \`dependencies\`, \`performance\`, \`experiment\`, \`RFC\`, \`support\`, \`P0\`, \`P1\`, \`P2\`.\n"
@@ -84,15 +87,21 @@ jobs:
84
87
fi
85
88
86
89
# Block PRs with labels that indicate they are not ready to merge.
87
-
BLOCKED_PATTERNS="blocked DO NOT MERGE do not merge"
88
-
for label in $LABEL_NAMES; do
89
-
for pattern in $BLOCKED_PATTERNS; do
90
-
if echo "$label" | grep -qi "$pattern"; then
91
-
ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n"
92
-
break
93
-
fi
94
-
done
95
-
done
90
+
# Match blocked label names exactly (case-insensitively); emit the
91
+
# original spelling from the payload so error text matches GitHub.
92
+
BLOCKED_LABELS=$(jq -r '
93
+
(["blocked", "do not merge"]) as $blocking
94
+
| .[]
95
+
| .name as $n
96
+
| if ($blocking | index($n | ascii_downcase)) != null
97
+
then $n
98
+
else empty
99
+
end
100
+
' <<<"$LABELS")
101
+
while IFS= read -r label; do
102
+
[ -n "$label" ] || continue
103
+
ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n"
104
+
done <<<"$BLOCKED_LABELS"
96
105
97
106
if [ -n "$ERRORS" ]; then
98
107
echo "::error::This PR is missing required metadata. See the job summary for details."
0 commit comments