diff --git a/.github/workflows/clang-tidy-check.yaml b/.github/workflows/clang-tidy-check.yaml index 88bfe7364..6aa1009c3 100644 --- a/.github/workflows/clang-tidy-check.yaml +++ b/.github/workflows/clang-tidy-check.yaml @@ -129,8 +129,18 @@ jobs: cd "$GITHUB_WORKSPACE/phlex-build" echo "➡️ Running clang-tidy checks..." - cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 || true - if [ -s clang-tidy-fixes.yaml ]; then + cmake_status=0 + cmake --build . --target clang-tidy-check -- --export-fixes clang-tidy-fixes.yaml > clang-tidy.log 2>&1 || cmake_status=$? + + # Distinguish tooling failures from issue detection by checking log content + if [ "$cmake_status" -ne 0 ]; then + if ! grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then + echo "::error::clang-tidy failed without producing diagnostic output (exit code $cmake_status)" + exit "$cmake_status" + fi + fi + + if grep -qE '^/.+\.(cpp|hpp|c|h):[0-9]+:[0-9]+: (warning|error):' clang-tidy.log; then echo "has_issues=true" >> "$GITHUB_OUTPUT" echo "::warning::Clang-tidy found issues in the code" echo "Error count by check (full details in clang-tidy-log artifact):"