Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,16 +235,18 @@ runs:
# Release version - download to temp file and verify hash
INSTALLER_URL="https://codspeed.io/v$RUNNER_VERSION/install.sh"
INSTALLER_TMP=$(mktemp)
trap "rm -f $INSTALLER_TMP" EXIT

CURL_ERR=$(mktemp)
if ! HTTP_CODE=$(curl -sSL -o "$INSTALLER_TMP" -w "%{http_code}" "$INSTALLER_URL" 2>"$CURL_ERR"); then
echo "::error title=Failed to install CodSpeed CLI::Installation of CodSpeed CLI with version $RUNNER_VERSION failed.%0AReason: $(cat "$CURL_ERR")"
exit 1
fi
if [ "$HTTP_CODE" -ge 400 ]; then
error_body=$(cat "$INSTALLER_TMP")
echo "::error title=Failed to install CodSpeed CLI::Installation of CodSpeed CLI with version $RUNNER_VERSION failed.%0AReason: HTTP $HTTP_CODE - ${error_body:-no response body}"
trap 'rm -f "$INSTALLER_TMP" "$CURL_ERR"' EXIT

# GitHub uses HTTP 618 for expired asset URLs, which plain --retry misses.
if ! HTTP_CODE=$(curl -fsSL --retry 2 --retry-all-errors --max-time 30 --retry-max-time 60 \
-o "$INSTALLER_TMP" -w "%{http_code}" "$INSTALLER_URL" 2>"$CURL_ERR"); then
if [[ "$HTTP_CODE" -ge 400 ]]; then
reason="HTTP $HTTP_CODE"
else
reason=$(cat "$CURL_ERR")
fi
echo "::error title=Failed to install CodSpeed CLI::Installation of CodSpeed CLI with version $RUNNER_VERSION failed.%0AReason: $reason"
exit 1
fi

Expand Down
Loading