From be046689fb0f85e27978a777ec3496e0e362baef Mon Sep 17 00:00:00 2001 From: Tony Garcia Date: Tue, 9 Jan 2024 17:35:51 -0600 Subject: [PATCH] Honor warnings from ansible-lint CI for ansible-lint PRs is ignoring the warnings from ansible-lint. Creating another section to highlight the warnings without failing the check. Including a new warning var-naming[no-role-prefix] while we decide to use this standard or keep the current one. Through this mechanism we can remove the warning list once we want to start truly enforcing them. --- .ansible-lint | 3 ++- .github/workflows/pr.yml | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index fb4c5f263..70b923005 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -10,7 +10,8 @@ exclude_paths: - plugins warn_list: - - yaml[line-length] - ignore-errors - no-changed-when + - var-naming[no-role-prefix] + - yaml[line-length] ... diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index c50d724fd..05c789942 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -47,7 +47,10 @@ jobs: # remove line numbers sed -i -r 's/:[0-9]+:/::/' branch.output main.output # export diff sans headers - diff -u0 branch.output main.output | tail -n +3 > diff.output + diff -u0 branch.output main.output | tail -n +3 > diff.raw + # Get warnings out of the diff + grep -P '\(warning\)(\x1B\[0m)?$' diff.raw > diff.warnings + grep -vP '\(warning\)(\x1B\[0m)?$' diff.raw > diff.output echo "## Improvements over main branch:" | tee -a ${GITHUB_STEP_SUMMARY} echo '```diff' >> ${GITHUB_STEP_SUMMARY} grep '^+' diff.output | @@ -62,6 +65,13 @@ jobs: sed -r 's/\x1B\[[0-9]{1,2}(;[0-9]{1,2})?[mGK]//g' | tee -a ${GITHUB_STEP_SUMMARY} echo '```' >> ${GITHUB_STEP_SUMMARY} + echo "## Warnings from main branch:" | tee -a ${GITHUB_STEP_SUMMARY} + echo '```diff' >> ${GITHUB_STEP_SUMMARY} + grep '^-' diff.warning | + sed -e 's/^-/-WARNING: /' | + 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} exit 1