Skip to content

Commit ca3d5c7

Browse files
committed
Add error catching to tinyuf2 steps
1 parent 00ca019 commit ca3d5c7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,28 +152,34 @@ jobs:
152152
- name: fetch tinyuf2 combined.bin
153153
run: |
154154
BOARD_NAME="${{fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}}"
155+
set +e
155156
for attempt in 1 2; do
156157
echo "Attempt $attempt: Fetching tinyuf2 release info for board $BOARD_NAME"
157158
API_RESPONSE=$(curl --silent --fail https://api.github.com/repos/adafruit/tinyuf2/releases/latest)
158159
if [ $? -ne 0 ]; then
159160
echo "Attempt $attempt: curl failed to fetch release info."
160161
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
161162
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."
163+
DOWNLOAD_URL=$(echo "$API_RESPONSE" | jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'$BOARD_NAME'-") and endswith(".zip")) | .browser_download_url // empty'); JQ_EXIT=$?
164+
if [ $JQ_EXIT -ne 0 ] || [ -z "$DOWNLOAD_URL" ]; then
165+
echo "Attempt $attempt: jq failed or no matching zip found."
165166
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
166167
fi
167168
echo "Attempt $attempt: Downloading $DOWNLOAD_URL"
168169
wget "$DOWNLOAD_URL" -O tinyuf2.zip
169170
if [ $? -eq 0 ]; then
170171
unzip -o tinyuf2.zip -d .
172+
if [ $? -ne 0 ]; then
173+
echo "Attempt $attempt: unzip failed"
174+
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
175+
fi
171176
break
172177
else
173178
echo "Attempt $attempt: wget failed to download $DOWNLOAD_URL"
174179
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; fi
175180
fi
176181
done
182+
set -e
177183
- name: move partition and bootloader files for tinyuf2 (to match flash_args)
178184
run: |
179185
# Copy files where they're expected to make flash_args happy

0 commit comments

Comments
 (0)