Skip to content

Commit ddbb6f1

Browse files
fix setup-python-bundle script
1 parent 693e70d commit ddbb6f1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

desktop/scripts/setup-python-bundle.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ esac
4848
# --- 3. Resolve latest install_only tarball URL ---
4949
echo "Resolving latest python-build-standalone ($TRIPLE) ..."
5050
API_URL="https://api.github.com/repos/$REPO/releases/latest"
51+
# Use GITHUB_TOKEN in CI to avoid rate limits (unauthenticated = 60/hr)
52+
CURL_API=(curl -sL)
53+
if [ -n "${GITHUB_TOKEN:-}" ]; then
54+
CURL_API+=(-H "Authorization: Bearer $GITHUB_TOKEN")
55+
fi
5156
if command -v jq &>/dev/null; then
5257
# (.assets // []) handles API errors or rate limits where .assets may be null
53-
ASSET_URL=$(curl -sL "$API_URL" | jq -r --arg t "$TRIPLE" '(.assets // [])[] | select(.name | test("install_only")) | select(.name | test($t)) | .browser_download_url' | head -1)
58+
ASSET_URL=$("${CURL_API[@]}" "$API_URL" | jq -r --arg t "$TRIPLE" '(.assets // [])[] | select(.name | test("install_only")) | select(.name | test($t)) | .browser_download_url' | head -1)
5459
else
55-
ASSET_URL=$(curl -sL "$API_URL" | grep -o '"browser_download_url": "[^"]*install_only[^"]*'"$TRIPLE"'[^"]*"' | head -1 | sed 's/.*: "\(.*\)".*/\1/')
60+
ASSET_URL=$("${CURL_API[@]}" "$API_URL" | grep -o '"browser_download_url": "[^"]*install_only[^"]*'"$TRIPLE"'[^"]*"' | head -1 | sed 's/.*: "\(.*\)".*/\1/')
5661
fi
5762
if [ -z "$ASSET_URL" ] || [ "$ASSET_URL" = "null" ]; then
5863
echo "Could not find install_only asset for $TRIPLE. Check https://github.com/$REPO/releases"

0 commit comments

Comments
 (0)