Skip to content
Merged
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
34 changes: 31 additions & 3 deletions scripts/actionlint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Comment thread
roryabraham marked this conversation as resolved.
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
Expand Down