Skip to content

Commit

Permalink
Merge pull request #131 from redhatci/warning_lint
Browse files Browse the repository at this point in the history
Honor warnings from ansible-lint
  • Loading branch information
tonyskapunk authored Jan 10, 2024
2 parents bcb1477 + be04668 commit c4a50e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -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]
...
12 changes: 11 additions & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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
Expand Down

0 comments on commit c4a50e0

Please sign in to comment.