diff --git a/format.sh b/format.sh index 0efc36f..9448ca1 100644 --- a/format.sh +++ b/format.sh @@ -3,20 +3,20 @@ filemask="$1" additional_options="$2" settings_file="$3" -tempdir=$(mktemp) -/opt/idea/bin/format.sh -m "$filemask" $additional_options -r -s /github/workspace/"$settings_file" /github/workspace/ 2>&1 | tee -a $tempdir/output -newly_formatted=$(cat $tempdir/output | grep "OK$" | wc -l) -formatted_well=$(cat $tempdir/output | grep "Formatted well$" | wc -l) -needs_reformatting=$(cat $tempdir/output | grep "Needs reformatting$" | wc -l) +tempfile=$(mktemp) +/opt/idea/bin/format.sh -m "$filemask" $additional_options -r -s /github/workspace/"$settings_file" /github/workspace/ | tee -a $tempfile +newly_formatted=$(cat $tempfile | grep "OK$" | wc -l) +formatted_well=$(cat $tempfile | grep "Formatted well$" | wc -l) +needs_reformatting=$(cat $tempfile | grep "Needs reformatting$" | wc -l) echo "Formatted ($newly_formatted)": -cat $tempdir/output | grep -o -P '(?<=Formatting ).*(?=...OK)' +cat $tempfile | grep -o -P '(?<=Formatting ).*(?=...OK)' echo echo "===================" echo echo "Formatted well ($formatted_well)": -cat $tempdir/output | grep -o -P '(?<=Checking ).*(?=...Formatted well)' +cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Formatted well)' echo echo "===================" echo echo "Needs reformatting ($needs_reformatting)": -! cat $tempdir/output | grep -o -P '(?<=Checking ).*(?=...Needs reformatting)' +! cat $tempfile | grep -o -P '(?<=Checking ).*(?=...Needs reformatting)'