Fix copied over (#7270)

Co-authored-by: Douwe Osinga <douwe@squareup.com> - this was approved just need to get it in
This commit is contained in:
Douwe Osinga
2026-02-17 14:41:57 +01:00
committed by GitHub
parent 8bd66e167a
commit 3acb37590f
+19
View File
@@ -197,9 +197,28 @@ DOWNLOAD_URL="https://github.com/$REPO/releases/download/$RELEASE_TAG/$FILE"
# --- 4) Download & extract 'goose' binary --- # --- 4) Download & extract 'goose' binary ---
echo "Downloading $RELEASE_TAG release: $FILE..." echo "Downloading $RELEASE_TAG release: $FILE..."
if ! curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then if ! curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then
# If the download fails, only fall back to latest stable when no version was specified and canary was not requested).
if ! [ -n "${GOOSE_VERSION:-}" ] && [ "${CANARY:-false}" != "true" ]; then
LATEST_TAG=$(curl -s https://api.github.com/repos/block/goose/releases/latest | \
grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
if [ -z "$LATEST_TAG" ]; then
echo "Error: Failed to download $DOWNLOAD_URL and latest tag unavailable"
exit 1
fi
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$LATEST_TAG/$FILE"
if curl -sLf "$DOWNLOAD_URL" --output "$FILE"; then
# Fallback succeeded
:
else
echo "Error: Failed to download from fallback url $DOWNLOAD_URL using latest tag $LATEST_TAG"
exit 1
fi
else
echo "Error: Failed to download $DOWNLOAD_URL" echo "Error: Failed to download $DOWNLOAD_URL"
exit 1 exit 1
fi fi
fi
# Create a temporary directory for extraction # Create a temporary directory for extraction
TMP_DIR="/tmp/goose_install_$RANDOM" TMP_DIR="/tmp/goose_install_$RANDOM"