From 74c9d6438c951512945c531f19d21023f200df6e Mon Sep 17 00:00:00 2001 From: sotashimozono Date: Wed, 9 Sep 2026 10:02:29 +0000 Subject: [PATCH] fix: gh api's 404 body landed in the URL for a repo with no Pages site MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Caught by the first pull request that exercised the new default. templateHPC.jl has no Pages site, and the comment it posted read https://docs.github.com/rest/pages/pages#get-a-apiname-pages-site","status":"404"}/previews/PR9/ `gh api` writes its error JSON to STDOUT, `--jq` passes it through unfiltered, and `|| true` hides the non-zero exit — so the fallback that exists for exactly this case never ran. Checked for SHAPE now rather than for exit code. Dry-run on both: no Pages site https://qatlashub.github.io/templateHPC.jl/previews/PR9/ Pages site https://qatlashub.github.io/SweepRunner.jl/previews/PR40/ (200) Co-Authored-By: Claude Opus 5 --- .github/workflows/docs-preview.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index d651d5a..6bd80c4 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -73,6 +73,11 @@ jobs: root="${BASE%/}/$NAME" else root=$(gh api "repos/$REPO/pages" --jq '.html_url' 2>/dev/null || true) + # Checked for SHAPE, not for exit code. With no Pages site `gh api` writes its 404 JSON + # to STDOUT, `--jq` passes it through, and `|| true` hides the failure — measured on + # templateHPC.jl, where the posted link began + # `https://docs.github.com/rest/pages/pages#...","status":"404"}/previews/PR9/`. + case "$root" in https://*) ;; *) root='' ;; esac # No Pages site yet, or no permission to read it: fall back to the host GitHub would # serve it from. Lowercased, because the owner may be spelled in mixed case. [ -n "$root" ] || root="https://$(printf '%s' "$OWNER" | tr '[:upper:]' '[:lower:]').github.io/$NAME"