Skip to content

Commit 71be2c2

Browse files
committed
Fix blocked-label check falsely matching "documentation"
The blocked-patterns loop word-split "DO NOT MERGE" into individual words, so "DO" matched as a substring of "documentation" via grep. Replace with a single grep -qiE regex and read labels line-by-line from jq to also handle multi-word label names correctly. Made-with: Cursor
1 parent 1086f40 commit 71be2c2

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,14 @@ jobs:
8484
fi
8585
8686
# 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
87+
# Read labels line-by-line (jq outputs one per line) to handle
88+
# multi-word label names; match with a single regex to avoid
89+
# word-splitting "DO NOT MERGE" into individual grep patterns.
90+
while IFS= read -r label; do
91+
if echo "$label" | grep -qiE "blocked|do not merge"; then
92+
ERRORS="${ERRORS}- **Blocked label detected**: label \`$label\` prevents merging. Remove it when the PR is ready.\n"
93+
fi
94+
done < <(echo "$LABELS" | jq -r '.[].name')
9695
9796
if [ -n "$ERRORS" ]; then
9897
echo "::error::This PR is missing required metadata. See the job summary for details."

0 commit comments

Comments
 (0)