Skip to content

Commit 30b2b87

Browse files
committed
act
1 parent 044bbb6 commit 30b2b87

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

.github/actions/clang-tidy-native/action.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,19 @@ runs:
7777
while IFS= read -r file; do
7878
if [ -n "$file" ] && [ -f "$file" ]; then
7979
echo "Analyzing $file..."
80+
FILE_OUTPUT=$(mktemp)
8081
if clang-tidy-${{ inputs.clang_tidy_version }} "$file" \
8182
-p ${{ inputs.build_dir }} --format-style=file 2>&1 | \
82-
tee -a "$COMMENTS_FILE"; then
83-
ISSUES=$(grep -c "warning:\|error:" "$COMMENTS_FILE" || echo "0")
84-
TOTAL_ISSUES=$((TOTAL_ISSUES + ISSUES))
83+
tee "$FILE_OUTPUT"; then
84+
ISSUES=$(grep -c "warning:\|error:" "$FILE_OUTPUT" 2>/dev/null || echo "0")
85+
ISSUES=$(echo "$ISSUES" | tr -d '[:space:]')
86+
TOTAL_ISSUES=$((TOTAL_ISSUES + ${ISSUES:-0}))
87+
cat "$FILE_OUTPUT" >> "$COMMENTS_FILE"
8588
else
8689
echo "::error::Failed to analyze $file"
8790
TOTAL_ISSUES=$((TOTAL_ISSUES + 1))
8891
fi
92+
rm -f "$FILE_OUTPUT"
8993
fi
9094
done <<< "${{ steps.changed-files.outputs.changed_files }}"
9195

0 commit comments

Comments
 (0)