diff --git a/scripts/actionlint.sh b/scripts/actionlint.sh index 84ceb99..e5229da 100755 --- a/scripts/actionlint.sh +++ b/scripts/actionlint.sh @@ -60,9 +60,37 @@ else info "Downloading and verifying actionlint verion $EXPECTED_VERSION..." >&2 readonly TARBALL="$SCRIPT_DIR/actionlint.tar.gz" - if ! curl -sL "https://github.com/rhysd/actionlint/releases/download/v${EXPECTED_VERSION}/${TARBALL_NAME}" -o "$TARBALL"; then - error "Unable to download actionlint binary" - exit 1 + + # --fail: Makes curl return error on HTTP errors (4xx, 5xx) + # --location: Follow redirects + # --retry: Retry on transient errors + # --retry-delay: Wait between retry attempts + curl --fail --location \ + --retry 3 \ + --retry-delay 3 \ + "https://github.com/rhysd/actionlint/releases/download/v${EXPECTED_VERSION}/${TARBALL_NAME}" \ + --output "$TARBALL" + CURL_EXIT=$? + + if [[ $CURL_EXIT -ne 0 ]]; then + case $CURL_EXIT in + 18) + error "Download failed: partial file transfer (network interrupted)" >&2 + ;; + 22) + error "Download failed: HTTP error from GitHub" >&2 + ;; + 28) + error "Download failed: operation timeout" >&2 + ;; + 56) + error "Download failed: network connection issue" >&2 + ;; + *) + error "Download failed with curl exit code $CURL_EXIT" >&2 + ;; + esac + exit "$CURL_EXIT" fi # Ensure tarball is cleaned up