ci: replace fixed 120s sleep with preview URL polling in PR workflows#43
Merged
Conversation
…enshots workflows Co-authored-by: Primajin <[email protected]>
Copilot
AI
changed the title
[WIP] Update pull request preview workflows with polling strategy
Replace fixed 120s sleep with preview URL polling in PR workflows
Jul 11, 2026
Contributor
|
Contributor
2026-07-11T09:10:09.300Z-iPad_Pro_landscape-7865b88.png2026-07-11T09:10:09.300Z-iPad_Pro-7865b88.png2026-07-11T09:10:09.300Z-iPhone_13-7865b88.png |
Primajin
marked this pull request as ready for review
July 11, 2026 09:10
Contributor
Console Logs✅ No logs were captured |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves the reliability and efficiency of PR preview-dependent workflows by replacing a fixed 120s wait with a polling mechanism that proceeds as soon as the GitHub Pages preview becomes available.
Changes:
- Add a job-level
PREVIEW_URLenv var as a single source of truth for the PR preview URL. - Replace the fixed
sleep 120sstep with acurl-based polling loop (up to 180s) that succeeds on HTTP 2xx. - Update downstream steps to consume
${{ env.PREVIEW_URL }}(removing the step-levelPR_NUMBERenv inscreenshots.yml).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/screenshots.yml | Adds PREVIEW_URL and replaces fixed sleep with polling before running screenshot capture against the preview. |
| .github/workflows/console.yml | Adds PREVIEW_URL, replaces fixed sleep with polling, and reuses the env var for the console log action URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| timeout=180 | ||
| elapsed=0 | ||
| until [ "$elapsed" -ge "$timeout" ]; do | ||
| status=$(curl --silent --output /dev/null --write-out "%{http_code}" "${PREVIEW_URL}" || true) |
| timeout=180 | ||
| elapsed=0 | ||
| until [ "$elapsed" -ge "$timeout" ]; do | ||
| status=$(curl --silent --output /dev/null --write-out "%{http_code}" "${PREVIEW_URL}" || true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



The console and screenshots PR preview workflows used a hard
sleep 120sto wait for the GitHub Pages preview to become available — too short sometimes, wasteful always. This replaces it with a curl polling loop that exits as soon as the preview responds 2xx (up to 180s timeout).Changes
Both
.github/workflows/console.ymland.github/workflows/screenshots.yml:PREVIEW_URLenv var — single source of truth for the preview URL, reused in all downstream stepsSleep for 120 secondsstep with a bash polling loop: checks every 5s, succeeds on any 2xx, exits 1 after 180s timeoutPR_NUMBERstep-level env inscreenshots.yml— now uses${{ env.PREVIEW_URL }}directly