diff --git a/.github/workflows/clang-linter.yml b/.github/workflows/clang-linter.yml index 3df01af9..67d6461e 100644 --- a/.github/workflows/clang-linter.yml +++ b/.github/workflows/clang-linter.yml @@ -32,7 +32,14 @@ jobs: - name: Run clang-tidy run: | clang-tidy --version - find . -path ./external -prune -o -name '*.c' -print | xargs clang-tidy -p $(pwd) + find . -path ./external -prune -o -name '*.c' -print | xargs clang-tidy -p $(pwd) > clang-tidy-output.txt + + - name: Count errors and warnings + id: count-errors + run: | + error_count=$(grep -oP "error generated" clang-tidy-output.txt | wc -l) + echo "error_count=$error_count" >> $GITHUB_ENV + echo "::set-output name=error_count::$error_count" comment-on-failure: name: Comment on PR if clang-tidy fails @@ -51,7 +58,8 @@ jobs: with: script: | const issue_number = context.payload.pull_request.number; - const comment_body = 'The linting workflow failed. Please check the clang-tidy output for details.'; + const errorCount = '${{ env.error_count }}'; + const comment_body = `The linting workflow failed with ${errorCount} errors. Please check the clang-tidy output for details.`; github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo,