2021-09-20 20:04:59 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-03-22 13:17:19 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2021-09-20 20:04:59 +00:00
|
|
|
#
|
|
|
|
# Add a comment on the github PR if there were any rerun tests.
|
|
|
|
#
|
|
|
|
set -eu -o pipefail
|
|
|
|
|
|
|
|
report_filename="${1?report filename is required}"
|
|
|
|
if [ ! -s "$report_filename" ]; then
|
|
|
|
echo "gotestsum rerun report file is empty or missing"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
function report {
|
|
|
|
echo ":repeat: gotestsum re-ran some tests in $CIRCLE_BUILD_URL"
|
|
|
|
echo
|
|
|
|
echo '```'
|
|
|
|
cat "$report_filename"
|
|
|
|
echo '```'
|
|
|
|
}
|
|
|
|
|
|
|
|
report
|