add error count

pull/3902/head
Yash Rathore 2024-03-20 16:10:31 -04:00
parent 72661dd4df
commit 4a28c22696
1 changed files with 10 additions and 2 deletions

View File

@ -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,