Skip to content

Commit

Permalink
Add step summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoref committed Jan 25, 2024
1 parent d82614f commit aa7825e
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion run-scalafmt.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
#!/bin/sh
scalafmt --non-interactive $args
output=$(mktemp)
warnings=$(mktemp)
scalafmt --non-interactive $args > "$output" 2> "$warnings"
result=$?
cat "$output"
cat "$warnings" >&2
[ $result -eq 0 ] && exit

report() {
file="$1"
summary="$2"

[ -s "$file" ] || return
echo "<details><summary>$summary</summary>"
echo
echo '```'
cat "$file"
echo '```'
echo '</details>'
echo
}

(
echo "# scalafmt failed ($result)"
report "$output" "Output"
report "$warnings" "Warnings"
) >> "$GITHUB_STEP_SUMMARY"
exit $result

0 comments on commit aa7825e

Please sign in to comment.