From 75f06869e122e5276d26c5395c46eff225245744 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Jul 2026 09:04:03 +0000 Subject: [PATCH 1/2] Initial plan From 80802e391b299f6835bb7b2d46272a710905d3da Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Jul 2026 09:05:17 +0000 Subject: [PATCH 2/2] Replace fixed 120s sleep with preview URL polling in console and screenshots workflows Co-authored-by: Primajin <1742115+Primajin@users.noreply.github.com> --- .github/workflows/console.yml | 23 ++++++++++++++++++++--- .github/workflows/screenshots.yml | 24 ++++++++++++++++++++---- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/.github/workflows/console.yml b/.github/workflows/console.yml index 697f7f8..7182a9b 100644 --- a/.github/workflows/console.yml +++ b/.github/workflows/console.yml @@ -13,6 +13,8 @@ jobs: console: runs-on: ubuntu-latest name: Get console logs + env: + PREVIEW_URL: https://primajin.github.io/Gyros/pr-preview/pr-${{ github.event.number }}/ steps: - name: Wait for build to succeed uses: fountainhead/action-wait-for-check@v1.2.0 @@ -25,16 +27,31 @@ jobs: if: steps.wait-for-build.outputs.conclusion == 'failure' run: exit 1 shell: bash - - name: Sleep for 120 seconds + - name: Wait for preview URL to be available if: steps.wait-for-build.outputs.conclusion == 'success' - run: sleep 120s shell: bash + run: | + echo "Polling ${PREVIEW_URL} ..." + timeout=180 + elapsed=0 + until [ "$elapsed" -ge "$timeout" ]; do + status=$(curl --silent --output /dev/null --write-out "%{http_code}" "${PREVIEW_URL}" || true) + if [[ "$status" =~ ^2 ]]; then + echo "Preview is live (HTTP ${status})" + exit 0 + fi + echo "HTTP ${status} – retrying in 5 s (${elapsed}/${timeout}s elapsed)" + sleep 5 + elapsed=$((elapsed + 5)) + done + echo "Timed out waiting for preview after ${timeout}s" + exit 1 - name: Checkout code uses: actions/checkout@v7 - name: Use WebApp Console Log Action uses: Primajin/webapp-console-log-action@v1.8.0 with: - webapp-url: https://primajin.github.io/Gyros/pr-preview/pr-${{ github.event.number }}/ + webapp-url: ${{ env.PREVIEW_URL }} regexp-error: 'Failed \D+ 404 \(\)' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/screenshots.yml b/.github/workflows/screenshots.yml index 6da65a1..166f8e7 100644 --- a/.github/workflows/screenshots.yml +++ b/.github/workflows/screenshots.yml @@ -13,6 +13,8 @@ jobs: screenshots: runs-on: ubuntu-latest name: Take a screenshot after page was built + env: + PREVIEW_URL: https://primajin.github.io/Gyros/pr-preview/pr-${{ github.event.number }}/ steps: - name: Wait for build to succeed uses: fountainhead/action-wait-for-check@v1.2.0 @@ -25,10 +27,25 @@ jobs: if: steps.wait-for-build.outputs.conclusion == 'failure' run: exit 1 shell: bash - - name: Sleep for 120 seconds + - name: Wait for preview URL to be available if: steps.wait-for-build.outputs.conclusion == 'success' - run: sleep 120s shell: bash + run: | + echo "Polling ${PREVIEW_URL} ..." + timeout=180 + elapsed=0 + until [ "$elapsed" -ge "$timeout" ]; do + status=$(curl --silent --output /dev/null --write-out "%{http_code}" "${PREVIEW_URL}" || true) + if [[ "$status" =~ ^2 ]]; then + echo "Preview is live (HTTP ${status})" + exit 0 + fi + echo "HTTP ${status} – retrying in 5 s (${elapsed}/${timeout}s elapsed)" + sleep 5 + elapsed=$((elapsed + 5)) + done + echo "Timed out waiting for preview after ${timeout}s" + exit 1 - name: Checkout code uses: actions/checkout@v7 - name: install puppeteer-headful @@ -43,10 +60,9 @@ jobs: noDesktop: true releaseId: 315671617 type: png - url: ${{ env.PR_NUMBER }} + url: ${{ env.PREVIEW_URL }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_NUMBER: https://primajin.github.io/Gyros/pr-preview/pr-${{ github.event.number }}/ - uses: actions/upload-artifact@v7 with: path: screenshots