Skip to content

Commit 95c43a5

Browse files
authored
ci(a11y): fix findings count writing malformed GITHUB_OUTPUT on zero findings (#3442)
The accessibility check job fails on any PR where a changed `src/gui` file has **zero** findings — the check itself passes, but the step errors with: ``` ##[error]Unable to process file command 'output' successfully. ##[error]Invalid format '0' ``` ## Cause `grep -c "^::warning"` prints `0` to stdout **and** exits non-zero when there are no matches. So: ```bash COUNT=$(grep -c "^::warning" /tmp/a11y_output.txt || echo "0") ``` captures **both** grep's own `0` and the `|| echo "0"`, producing the two-line value `"0\n0"`. Writing `findings=0\n0` to `$GITHUB_OUTPUT` is malformed → step failure. ## Fix ```diff - COUNT=$(grep -c "^::warning" /tmp/a11y_output.txt || echo "0") + COUNT=$(grep -c "^::warning" /tmp/a11y_output.txt || true) ``` `grep -c` already prints `0` on no match; `|| true` simply swallows its non-zero exit under `set -e`, without appending a duplicate. Verified locally: | Input | Old `COUNT` | New `COUNT` | |---|---|---| | no `::warning` lines | `0\n0` (malformed) | `0` | | 2 `::warning` lines | `2` | `2` | Seen on #3441 (a clean GUI change with 0 a11y findings).
1 parent 9182fda commit 95c43a5

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/workflows/a11y-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
exit 0
4141
fi
4242
python tools/check_a11y.py $FILES | tee /tmp/a11y_output.txt
43-
COUNT=$(grep -c "^::warning" /tmp/a11y_output.txt || echo "0")
43+
COUNT=$(grep -c "^::warning" /tmp/a11y_output.txt || true)
4444
echo "findings=$COUNT" >> $GITHUB_OUTPUT
4545
4646
# Post a summary comment so the finding count is visible at the PR top

0 commit comments

Comments
 (0)