Skip to content

Commit 0c4ee7f

Browse files
author
mergetest
committed
release.yml: make locale validation fail on a glob miss
The check globbed .release/DandersFrames/Locales/*.lua with no nullglob, so an unmatched pattern stayed literal, grep errored on the missing file, ERRORS stayed 0, and the step printed "All locale files validated OK" and exited 0. The guard could not tell "no problems" from "wrong path" — poor for a check whose whole job is catching broken locales, and newly dangerous now the addon layout can move. Now sets nullglob, counts the matches, and fails with a specific error when the count is zero. Also swaps grep -P for -E. The pattern uses no PCRE syntax, and -P is unavailable in some environments ("supports only unibyte and UTF-8 locales"). Combined with the existing 2>/dev/null, a grep that cannot run reads as "file is clean" — the same silent pass. Verified -E matches all four alternatives identically.
1 parent b2f0297 commit 0c4ee7f

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,27 @@ jobs:
8989
- name: Validate locale files
9090
if: steps.guard.outputs.skip != 'true'
9191
run: |
92+
# ☠ A glob that matches nothing must FAIL, not pass silently.
93+
# Without nullglob an unmatched pattern stays literal, grep errors on the
94+
# missing file, ERRORS stays 0, and this step prints "validated OK" while
95+
# checking nothing — so the guard cannot tell "no problems" from "wrong
96+
# path". That matters now the addon layout can move (12.1 container reorg).
97+
shopt -s nullglob
98+
FILES=(.release/DandersFrames/Locales/*.lua)
99+
if [ ${#FILES[@]} -eq 0 ]; then
100+
echo "::error::No locale files matched .release/DandersFrames/Locales/*.lua — the packaged layout changed and this check is validating nothing. Fix the path."
101+
exit 1
102+
fi
103+
echo "Validating ${#FILES[@]} locale file(s)"
104+
92105
ERRORS=0
93-
for f in .release/DandersFrames/Locales/*.lua; do
94-
# Check for CurseForge API error responses injected as raw text
95-
if grep -qP '^error code:|^<!DOCTYPE|^<html|^\{"error' "$f" 2>/dev/null; then
106+
for f in "${FILES[@]}"; do
107+
# Check for CurseForge API error responses injected as raw text.
108+
# -E, not -P: the pattern needs no PCRE, and -P is unavailable in some
109+
# environments ("supports only unibyte and UTF-8 locales"). Paired with
110+
# 2>/dev/null, a grep that fails to run reads as "file is clean" — the
111+
# same silent pass the nullglob guard above exists to prevent.
112+
if grep -qE '^error code:|^<!DOCTYPE|^<html|^\{"error' "$f" 2>/dev/null; then
96113
echo "::error::Locale file contains API error response: $(basename $f)"
97114
head -5 "$f"
98115
ERRORS=$((ERRORS + 1))

0 commit comments

Comments
 (0)