Skip to content

Commit 8764cd6

Browse files
committed
Provide more info if tinyuf2 release fetch failure
1 parent 47c0e63 commit 8764cd6

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

.github/workflows/build-clang-doxy.yml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,29 @@ jobs:
151151
} >> "$GITHUB_OUTPUT"
152152
- name: fetch tinyuf2 combined.bin
153153
run: |
154-
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/adafruit/tinyuf2/releases/latest | \
155-
jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'${{fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}}'-") and endswith(".zip")) | .browser_download_url')
156-
if [ -z "$DOWNLOAD_URL" ]; then
157-
echo "Error: Could not find the latest tinyuf2 release for board ${fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}."
158-
exit 1
159-
fi
160-
wget "$DOWNLOAD_URL" -O tinyuf2.zip
161-
unzip -o tinyuf2.zip -d .
162-
154+
BOARD_NAME="${{fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}}"
155+
for attempt in 1 2; do
156+
echo "Attempt $attempt: Fetching tinyuf2 release info for board $BOARD_NAME"
157+
API_RESPONSE=$(curl -s https://api.github.com/repos/adafruit/tinyuf2/releases/latest)
158+
if [ $? -ne 0 ]; then
159+
echo "Attempt $attempt: curl failed to fetch release info."
160+
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
161+
fi
162+
DOWNLOAD_URL=$(echo "$API_RESPONSE" | jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'$BOARD_NAME'-") and endswith(".zip")) | .browser_download_url // empty')
163+
if [ -z "$DOWNLOAD_URL" ]; then
164+
echo "Attempt $attempt: No matching tinyuf2 zip found for board $BOARD_NAME."
165+
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
166+
fi
167+
echo "Attempt $attempt: Downloading $DOWNLOAD_URL"
168+
wget "$DOWNLOAD_URL" -O tinyuf2.zip
169+
if [ $? -eq 0 ]; then
170+
unzip -o tinyuf2.zip -d .
171+
break
172+
else
173+
echo "Attempt $attempt: wget failed to download $DOWNLOAD_URL"
174+
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; fi
175+
fi
176+
done
163177
- name: move partition and bootloader files for tinyuf2 (to match flash_args)
164178
run: |
165179
# Copy files where they're expected to make flash_args happy

0 commit comments

Comments
 (0)