Fail the cppcheck job on a finding

The cppcheck step pipes through tee, so its exit code was lost and the
job passed with findings. Run the step under bash, which sets pipefail,
and upload the results file only when the step fails.
pull/1340/merge
John Safranek 2026-10-30 15:29:30 -07:00 committed by philljj
parent 1c456fc843
commit 00f3e74e1c
1 changed files with 3 additions and 1 deletions

View File

@ -24,6 +24,8 @@ jobs:
- name: Run CppCheck
id: cpp_check_run
if: always()
# bash gets -o pipefail, so tee keeps cppcheck's exit code
shell: bash
run: >
cppcheck
-UWSCPFILEHDR -UXSNPRINTF
@ -41,7 +43,7 @@ jobs:
3>&1 1>&2 2>&3 | tee cppcheck.txt
- name: Upload cppcheck results as artifact
if: always()
if: failure() && steps.cpp_check_run.outcome == 'failure'
uses: actions/upload-artifact@v7
with:
name: wolfssh-${{ github.sha }}-cppcheck_results.txt