Skip to content

Commit 72dc71b

Browse files
committed
ci(docs): harden Natural Docs download with retries and zip validation
naturaldocs.org has been intermittently serving error pages to GitHub runner IPs, silently writing a non-zip into nd.zip and failing the deploy. Add curl --fail/--show-error with 5 retries (--retry-all-errors) and a PK-magic-byte guard so a bad download fails loudly instead of reaching unzip.
1 parent acf6043 commit 72dc71b

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎.github/workflows/docs.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,15 @@ jobs:
3030

3131
- name: Install Natural Docs
3232
run: |
33-
curl -sL "https://www.naturaldocs.org/download/natural_docs/2.4/Natural_Docs_2.4_Development_Release_2.Linux.x64.zip" -o nd.zip
33+
curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 \
34+
"https://www.naturaldocs.org/download/natural_docs/2.4/Natural_Docs_2.4_Development_Release_2.Linux.x64.zip" \
35+
-o nd.zip
36+
# Guard against the server returning an error page (not a zip) or a truncated download.
37+
if [ "$(head -c 2 nd.zip)" != "PK" ]; then
38+
echo "::error::Natural Docs download is not a valid zip archive."
39+
file nd.zip || true
40+
exit 1
41+
fi
3442
unzip -q nd.zip -d naturaldocs
3543
chmod +x "naturaldocs/Natural Docs/NaturalDocs"
3644

0 commit comments

Comments
 (0)