diff --git a/action.yml b/action.yml index 0864e9e..80f948d 100644 --- a/action.yml +++ b/action.yml @@ -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