fix(ci): fix audit-checks crash (set -e + grep exit code + ANSI in output)

This commit is contained in:
Pier-Jean Malandrino 2026-04-09 13:25:15 +02:00
parent 3c9d09c4e2
commit 2aa56d8ca2
2 changed files with 9 additions and 7 deletions

View file

@ -190,12 +190,14 @@ jobs:
id: results id: results
if: always() if: always()
run: | run: |
PASS=$(grep -c "PASS" /tmp/audit-checks.txt || echo "0") # Strip ANSI codes before counting
WARN=$(grep -c "WARN" /tmp/audit-checks.txt || echo "0") CLEAN=$(sed 's/\x1b\[[0-9;]*m//g' /tmp/audit-checks.txt)
FAIL=$(grep -c "FAIL" /tmp/audit-checks.txt || echo "0") PASS=$(echo "$CLEAN" | grep -c "PASS" || true)
echo "pass=$PASS" >> "$GITHUB_OUTPUT" WARN=$(echo "$CLEAN" | grep -c "WARN" || true)
echo "warn=$WARN" >> "$GITHUB_OUTPUT" FAIL=$(echo "$CLEAN" | grep -c "FAIL" || true)
echo "fail=$FAIL" >> "$GITHUB_OUTPUT" echo "pass=${PASS:-0}" >> "$GITHUB_OUTPUT"
echo "warn=${WARN:-0}" >> "$GITHUB_OUTPUT"
echo "fail=${FAIL:-0}" >> "$GITHUB_OUTPUT"
- name: Upload audit results - name: Upload audit results
if: always() if: always()

View file

@ -7,7 +7,7 @@
# Run from the repository root. # Run from the repository root.
# ============================================================================ # ============================================================================
set -euo pipefail set -uo pipefail
RED='\033[0;31m' RED='\033[0;31m'
GREEN='\033[0;32m' GREEN='\033[0;32m'