File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,15 +34,30 @@ if [[ -z "$DOWNLOAD_URL" ]]; then
3434fi
3535echo " Downloading $DOWNLOAD_URL "
3636
37- # Download and extract (nightly.link double-zips)
38- curl -sL -o " $TMPDIR /goose.zip" " $DOWNLOAD_URL "
37+ # Download artifact — try nightly.link first, fall back to gh CLI
38+ if ! curl -fSL --connect-timeout 10 -o " $TMPDIR /goose.zip" " $DOWNLOAD_URL " 2> /dev/null; then
39+ echo " nightly.link unavailable, falling back to GitHub API..."
40+ RUN_ID=$( echo " $DOWNLOAD_URL " | grep -oE ' actions/runs/[0-9]+' | cut -d/ -f3)
41+ ARTIFACT_NAME=$( echo " $DOWNLOAD_URL " | sed ' s/\.zip$//' | xargs basename)
42+ ARTIFACT_ID=$( gh api " repos/$REPO /actions/runs/$RUN_ID /artifacts" \
43+ --jq " .artifacts[] | select(.name==\" $ARTIFACT_NAME \" ) | .id" )
44+ if [[ -z " $ARTIFACT_ID " ]]; then
45+ echo " Could not find artifact '$ARTIFACT_NAME ' for run $RUN_ID "
46+ exit 1
47+ fi
48+ gh api " repos/$REPO /actions/artifacts/$ARTIFACT_ID /zip" > " $TMPDIR /goose.zip"
49+ fi
50+ echo " Done."
51+
3952unzip -o -q " $TMPDIR /goose.zip" -d " $TMPDIR /extracted"
4053
4154INNER_ZIP=$( find " $TMPDIR /extracted" -name " *.zip" | head -1)
4255if [[ -n " $INNER_ZIP " ]]; then
4356 unzip -o -q " $INNER_ZIP " -d " $TMPDIR /extracted"
4457fi
4558
59+ echo " unzipped"
60+
4661APP=$( find " $TMPDIR /extracted" -name " *.app" -maxdepth 2 | head -1)
4762if [[ -z " $APP " ]]; then
4863 echo " No .app found in archive."
You can’t perform that action at this time.
0 commit comments