From 7663e437619faad003608d5a6153c56912d396d8 Mon Sep 17 00:00:00 2001
From: pmckinney-codat
Date: Wed, 5 Aug 2026 14:54:56 +0100
Subject: [PATCH] Wait for Pages deployment before posting preview link
pr-preview-action posts its sticky comment as soon as the build lands
on gh-pages, ~30-60s before the GitHub Pages deployment finishes, so
the preview link 404s at first. wait-for-pages-deployment holds the
comment until the deployment is live; pages: read lets the wait poll
the Pages builds API (the explicit permissions block zeroes it
otherwise).
Co-Authored-By: Claude Fable 5
---
.github/workflows/pr.yml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 0783150c6..7d2d3bb6a 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -135,6 +135,8 @@ jobs:
permissions:
contents: write
pull-requests: write
+ # wait-for-pages-deployment polls the Pages builds API
+ pages: read
steps:
- uses: actions/checkout@v7
with:
@@ -177,3 +179,6 @@ jobs:
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./build
+ # Hold the sticky comment until the Pages deployment is live;
+ # otherwise the preview link 404s for the first minute or so
+ wait-for-pages-deployment: true