Skip to content

Instantly share code, notes, and snippets.

@christiannwamba
Created July 8, 2026 20:06
Show Gist options
  • Select an option

  • Save christiannwamba/cea9ac8465e76cb5d731499f190886f9 to your computer and use it in GitHub Desktop.

Select an option

Save christiannwamba/cea9ac8465e76cb5d731499f190886f9 to your computer and use it in GitHub Desktop.
Vercel preview e2e as a blocking PR check (deployment_status trigger)
# Runs Playwright e2e against the Vercel preview URL, as a PR check.
#
# Why deployment_status (not repository_dispatch): GitHub associates
# repository_dispatch runs with the default branch, so they never appear
# in a PR's checks and can't block a merge. deployment_status events are
# tied to the deployed commit (the PR head SHA), so this run shows up on
# the PR and can be marked as a required status check in branch protection.
#
# Notes:
# - This file must be on the default branch to trigger (same rule as
# repository_dispatch).
# - The Preview guard stops it re-running on Production deploys.
# - If Deployment Protection is enabled, send the Protection Bypass for
# Automation secret as the `x-vercel-protection-bypass` header, e.g. via
# Playwright's extraHTTPHeaders — otherwise tests hit the Vercel SSO page.
name: Playwright Tests
on:
deployment_status:
jobs:
run-e2es:
if: >-
github.event.deployment_status.state == 'success' &&
github.event.deployment.environment == 'Preview'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.deployment.sha }}
- name: Install dependencies
run: npm ci && npx playwright install --with-deps
- name: Run tests
run: npx playwright test
env:
BASE_URL: ${{ github.event.deployment_status.environment_url }}
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment