Skip to content

Harden PR preview workflow against transient deploy/comment failures#6919

Merged
jstirnaman merged 3 commits intomasterfrom
copilot/fix-pr-preview-failure
Mar 10, 2026
Merged

Harden PR preview workflow against transient deploy/comment failures#6919
jstirnaman merged 3 commits intomasterfrom
copilot/fix-pr-preview-failure

Conversation

Copy link
Contributor

Copilot AI commented Mar 10, 2026

PR previews occasionally failed after a successful deploy because the visual/comment step errored, causing the job to report failure despite publishing the preview.

  • Deploy step resilience: Run the rossjrw/pr-preview-action deploy step with continue-on-error so transient post-deploy/comment issues don’t abort the job.
  • Explicit validation: Add a validation step that requires a deployment URL and treats non-success outcomes as comment/visual transient errors when the URL exists.
  • Success comment gating: Post the success comment only after validation confirms a usable preview URL.

Example (workflow excerpt):

- name: Deploy preview
  id: deploy-preview
  continue-on-error: true
  uses: rossjrw/pr-preview-action@v1.4.8
  with:
    source-dir: ./preview-staging
    preview-branch: gh-pages
    umbrella-dir: pr-preview
    action: deploy

- name: Validate preview deployment
  id: validate-deploy
  run: |
    DEPLOY_OUTCOME="${{ steps.deploy-preview.outcome }}"
    DEPLOY_URL="${{ steps.deploy-preview.outputs.deployment-url }}"
    if [ -z "$DEPLOY_URL" ]; then exit 1; fi
    if [ "$DEPLOY_OUTCOME" != "success" ]; then
      echo "Preview URL exists; treating as transient post-deploy error."
    fi
    echo "status=ok" >> "$GITHUB_OUTPUT"

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: jstirnaman <212227+jstirnaman@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix PR preview failure due to race condition Harden PR preview workflow against transient deploy/comment failures Mar 10, 2026
@jstirnaman jstirnaman marked this pull request as ready for review March 10, 2026 16:49
@jstirnaman jstirnaman requested a review from a team as a code owner March 10, 2026 16:49
@jstirnaman jstirnaman requested review from jstirnaman and removed request for a team March 10, 2026 16:49
@jstirnaman jstirnaman merged commit 478a0ff into master Mar 10, 2026
2 checks passed
@jstirnaman jstirnaman deleted the copilot/fix-pr-preview-failure branch March 10, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants