Skip to content

Commit

Permalink
fixed a single line as summary
Browse files Browse the repository at this point in the history
  • Loading branch information
nulls committed Dec 18, 2023
1 parent 874fc7c commit 9ed27ed
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ runs:
chmod +x ${DIKTAT_CMD}
{ ${DIKTAT_CMD} "${DIKTAT_ARGS[@]}" "${INPUT_PATHS[@]}" | tee diktat.log; } && exit_code=$? || exit_code=$?
total_lines=$(wc -l diktat.log | cut -d ' ' -f1)
summary_line=$(grep -n 'Summary error count (descending) by rule:' diktat.log | cut -d: -f1)
# echo "summary-line=$(tail -n $((total_lines - summary_line)) diktat.log 2>/dev/null)" >>$GITHUB_OUTPUT
echo "summary-line=$(tail -n1 diktat.log 2>/dev/null)" >>$GITHUB_OUTPUT
summary_line_number=$(grep -n 'Summary error count (descending) by rule:' diktat.log | cut -d: -f1)
summary_line=$(tail -n $((total_lines - summary_line_number)) diktat.log | sed -e 's/^ //g' | awk '{ printf("%s,", $0) } END { printf "\n" }' | sed -e 's/,$//g')
echo "summary-line=${summary_line} >>$GITHUB_OUTPUT
rm -f diktat.log
echo "exit-code=${exit_code}" >>$GITHUB_OUTPUT
env:
Expand Down Expand Up @@ -156,7 +156,7 @@ runs:
if (( ${{ steps.diktat.outputs.exit-code }} != 0 ))
then
echo '```console' >>${GITHUB_STEP_SUMMARY}
echo "${{ steps.diktat.outputs.summary-line }}" >>${GITHUB_STEP_SUMMARY}
${{ steps.diktat.outputs.summary-line }} | xargs -d ',' -n1 echo >>${GITHUB_STEP_SUMMARY}
echo '```' >>${GITHUB_STEP_SUMMARY}
fi
Expand Down

0 comments on commit 9ed27ed

Please sign in to comment.