ci: Surface lint and test results to comment

It's a bit annoying how you have to go to the workflow result to see the lint error and test results. This surfaces it to the comment in the PR.
This commit is contained in:
Nick Bolton 2025-08-06 12:16:16 +01:00
parent d7f882f0c4
commit cf1789545a
2 changed files with 24 additions and 7 deletions

View file

@ -65,8 +65,15 @@ runs:
)
echo "$summary" >> $GITHUB_STEP_SUMMARY
file="ci_summary.md"
echo "❌🛠️ \`clang-format\`: Lint errors, fix available." >> $file
pr_comment=$(cat <<EOF
### Lint result
$summary
EOF
)
file="ci-summary.md"
echo "$pr_comment" | tee $file
echo "file=$file" >> $GITHUB_OUTPUT
shell: bash

View file

@ -57,15 +57,25 @@ runs:
if [ -z "$table" ]; then
echo "No test results found" | tee $GITHUB_STEP_SUMMARY >&2
exit 1
else
echo "$table" > $GITHUB_STEP_SUMMARY
fi
count=$(echo "$table" | awk -v RS='' '{gsub(/[^❌]/, ""); print length}')
file="ci-summary.md"
echo "$table" > $GITHUB_STEP_SUMMARY
count=$(echo "$table" | awk -v RS='' '{gsub(/[^❌]/, ""); print length}')
# Keep at this indentation level for heredoc.
fail_summary=$(cat <<EOF
### Test result
❌🔬 Tests failed: $count
$table
EOF
)
file="ci-summary.md"
if [ $count -gt 0 ]; then
echo "❌🔬 Tests failed: $count" | tee $file
echo "$fail_summary" | tee $file
echo "file=$file" >> $GITHUB_OUTPUT
else
# For debugging; don't send success to CI summary (reduce noise).