Skip to content

Commit 8efcdac

Browse files
authored
Merge branch 'main' into cuda-bindings-examples
2 parents b760170 + fc1ff27 commit 8efcdac

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

.github/workflows/pr-metadata-check.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,20 @@ jobs:
4646
4747
# Module labels identify which package the PR touches.
4848
# Cross-cutting labels exempt PRs from needing a module label.
49-
LABEL_NAMES=$(echo "$LABELS" | jq -r '.[].name')
49+
# Read label names line-by-line (jq outputs one per line) so
50+
# multi-word GitHub labels are not split by shell word-splitting.
5051
MODULE_LABELS="cuda.bindings cuda.core cuda.pathfinder"
5152
MODULE_EXEMPT_LABELS="CI/CD"
5253
HAS_MODULE=false
53-
for label in $LABEL_NAMES; do
54+
while IFS= read -r label; do
55+
[ -n "$label" ] || continue
5456
for mod in $MODULE_LABELS $MODULE_EXEMPT_LABELS; do
5557
if [ "$label" = "$mod" ]; then
5658
HAS_MODULE=true
5759
break 2
5860
fi
5961
done
60-
done
62+
done < <(echo "$LABELS" | jq -r '.[].name')
6163
6264
if [ "$HAS_MODULE" = "false" ]; then
6365
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:
6668
# Type labels categorize the kind of change.
6769
TYPE_LABELS="bug enhancement feature documentation test example CI/CD packaging dependencies performance experiment RFC support P0 P1 P2"
6870
HAS_TYPE=false
69-
for label in $LABEL_NAMES; do
71+
while IFS= read -r label; do
72+
[ -n "$label" ] || continue
7073
for typ in $TYPE_LABELS; do
7174
if [ "$label" = "$typ" ]; then
7275
HAS_TYPE=true
7376
break 2
7477
fi
7578
done
76-
done
79+
done < <(echo "$LABELS" | jq -r '.[].name')
7780
7881
if [ "$HAS_TYPE" = "false" ]; then
7982
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:
8487
fi
8588
8689
# 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"
96105
97106
if [ -n "$ERRORS" ]; then
98107
echo "::error::This PR is missing required metadata. See the job summary for details."
@@ -107,7 +116,7 @@ jobs:
107116
fi
108117
109118
ASSIGNEE_LIST=$(echo "$ASSIGNEES" | jq -r '.[].login' | paste -sd ', ' -)
110-
LABEL_LIST=$(echo "$LABEL_NAMES" | paste -sd ', ' -)
119+
LABEL_LIST=$(echo "$LABELS" | jq -r '.[].name' | paste -sd ', ' -)
111120
{
112121
echo "## PR Metadata Check Passed"
113122
echo ""

0 commit comments

Comments
 (0)