Skip to content

Commit

Permalink
Errors live in the output channel
Browse files Browse the repository at this point in the history
Retitle output as a status channel
  • Loading branch information
jsoref committed Jan 25, 2024
1 parent 2515d68 commit 4342c7b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions run-scalafmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,27 @@ report() {

errors=$(mktemp)

if grep -q '^error:' "$warnings"; then
warnings="$warnings" errors="$errors" perl -e '
my $new_warnings = "$ENV{warnings}.new";
open my $warnings_in, "<", $ENV{warnings};
open my $warnings_out, ">", $new_warnings;
if grep -q '^error:' "$output"; then
output="$output" errors="$errors" perl -e '
my $new_output = "$ENV{output}.new";
open my $output_in, "<", $ENV{output};
open my $output_out, ">", $new_output;
open my $errors, ">", $ENV{errors};
my $found_error=0;
while (<$warnings_in>) {
while (<$output_in>) {
if ($found_error) {
print $errors $_;
} elsif (/^error:/) {
$found_error=1;
print $errors $_;
} else {
print $warnings_out $_;
print $output_out $_;
}
}
close $warnings_in;
close $warnings_out;
close $output_in;
close $output_out;
close $errors;
rename new_warnings, $ENV{warnings};
rename $new_output, $ENV{output};
'
fi

Expand All @@ -61,7 +61,7 @@ fi
echo '# Errors'
cat "$errors"
fi
report "$output" "Output"
report "$warnings" "Warnings"
report "$output" "Status"
) >> "$GITHUB_STEP_SUMMARY"
exit $result

0 comments on commit 4342c7b

Please sign in to comment.