From 90f0d633e2d408b714c2c3c03c8b78ba12096435 Mon Sep 17 00:00:00 2001 From: Tony Garcia Date: Tue, 19 Dec 2023 17:10:26 -0600 Subject: [PATCH] Filter ANSI color codes from ansible-lint output Removes the ansi code before adding it to the GH step summary for a propoer reading --- .github/workflows/pr.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 174daea51..f84d3ce3c 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -46,11 +46,17 @@ jobs: diff -u0 branch.output main.output | tail -n +3 > diff.output echo "## Improvements over main branch:" | tee -a ${GITHUB_STEP_SUMMARY} echo '```diff' >> ${GITHUB_STEP_SUMMARY} - grep '^+' diff.output | sed -e 's/^+/+FIXED: /' | tee -a ${GITHUB_STEP_SUMMARY} + grep '^+' diff.output | + sed -e 's/^+/+FIXED: /' | + sed -r 's/\x1B\[[0-9]{1,2}(;[0-9]{1,2})?[mGK]//g' | + tee -a ${GITHUB_STEP_SUMMARY} echo '```' >> ${GITHUB_STEP_SUMMARY} echo "## Regressions from main branch:" | tee -a ${GITHUB_STEP_SUMMARY} echo '```diff' >> ${GITHUB_STEP_SUMMARY} - grep '^-' diff.output | sed -e 's/^-/-ERROR: /' | tee -a ${GITHUB_STEP_SUMMARY} + grep '^-' diff.output | + sed -e 's/^-/-ERROR: /' | + sed -r 's/\x1B\[[0-9]{1,2}(;[0-9]{1,2})?[mGK]//g' | + tee -a ${GITHUB_STEP_SUMMARY} echo '```' >> ${GITHUB_STEP_SUMMARY} if grep -q '^-' diff.output; then echo "> Fix regressions listed above" | tee -a ${GITHUB_STEP_SUMMARY}