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
66
if [ "$label" = "$mod" ]; then
56
67
HAS_MODULE=true
57
68
break 2
58
69
fi
59
70
done
60
-
done
71
+
done < <(echo "$LABELS" | jq -r '.[].name')
61
72
62
73
if [ "$HAS_MODULE" = "false" ]; then
63
74
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 +77,15 @@ jobs:
66
77
# Type labels categorize the kind of change.
67
78
TYPE_LABELS="bug enhancement feature documentation test example CI/CD packaging dependencies performance experiment RFC support P0 P1 P2"
68
79
HAS_TYPE=false
69
-
for label in $LABEL_NAMES; do
80
+
while IFS= read -r label; do
81
+
[ -n "$label" ] || continue
70
82
for typ in $TYPE_LABELS; do
71
83
if [ "$label" = "$typ" ]; then
72
84
HAS_TYPE=true
73
85
break 2
74
86
fi
75
87
done
76
-
done
88
+
done < <(echo "$LABELS" | jq -r '.[].name')
77
89
78
90
if [ "$HAS_TYPE" = "false" ]; then
79
91
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 +96,21 @@ jobs:
84
96
fi
85
97
86
98
# 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
99
+
# Match blocked label names exactly (case-insensitively); emit the
100
+
# original spelling from the payload so error text matches GitHub.
101
+
BLOCKED_LABELS=$(jq -r '
102
+
(["blocked", "do not merge"]) as $blocking
103
+
| .[]
104
+
| .name as $n
105
+
| if ($blocking | index($n | ascii_downcase)) != null
106
+
then $n
107
+
else empty
108
+
end
109
+
' <<<"$LABELS")
110
+
while IFS= read -r label; do
111
+
[ -n "$label" ] || continue
112
+
ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n"
113
+
done <<<"$BLOCKED_LABELS"
96
114
97
115
if [ -n "$ERRORS" ]; then
98
116
echo "::error::This PR is missing required metadata. See the job summary for details."
0 commit comments