Skip to content

Commit c8b996b

Browse files
committed
Add warning annotation in CI.
1 parent e1bcaaf commit c8b996b

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/iwyu.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ jobs:
6262

6363
- name: count warnings
6464
run: |
65+
set +e
6566
cd build
66-
export WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log`
67+
readonly WARNING_COUNT=`grep -c "include-what-you-use reported diagnostics:" iwyu.log`
6768
echo "include-what-you-use reported ${WARNING_COUNT} warning(s)"
6869
# Acceptable limit, to decrease over time down to 0
69-
export WARNING_LIMIT=10
70+
readonly WARNING_LIMIT=10
7071
# FAIL the build if WARNING_COUNT > WARNING_LIMIT
71-
exit $(( WARNING_COUNT > WARNING_LIMIT ? 1 : 0 ))
72+
if [ $WARNING_COUNT -gt $WARNING_LIMIT ] ; then
73+
exit 1
74+
# WARN in annotations if WARNING_COUNT > 0
75+
elif [ $WARNING_COUNT -gt 0 ] ; then
76+
echo "::warning::include-what-you-use reported ${WARNING_COUNT} warning(s)"
77+
fi

0 commit comments

Comments
 (0)