Skip to main content
When your app deploys to Vercel, every pull request gets its own preview URL. Peeps can run the pull request’s tests against that preview, so a failure means this change broke it, not something else on a shared environment. This takes three things: Vercel tells GitHub about each deployment, your Peeps workflow waits for the pull request’s preview and tests it, and Vercel lets the workflow past its login.
Peeps code review needs none of this. It reviews every pull request on a repository where code review is on, whether or not you deploy previews.

1. Let Vercel tell GitHub about deployments

In Vercel, open your project, then Settings > Git, and turn on deployment_status Events. New Vercel projects leave this off. Without it, Vercel posts only a commit status that links to the Vercel dashboard, and nothing in GitHub says where the preview lives. With it on, Vercel records a GitHub deployment for each commit, with the preview’s URL.

2. Test the pull request’s preview

Add preview: vercel to the Peeps step and run the workflow on pull_request. On a pull request the Peeps action waits for the preview of the pull request’s head commit and sets BASE_URL to it before your tests start. Start the job from pull_request, not from Vercel’s deployment_status event: Peeps counts a job as the pull request’s tests only when it runs on the pull request. See Pull request tests below.
.github/workflows/peeps.yml
What preview: vercel does:
  • It finds the GitHub deployment Vercel recorded for the pull request’s head commit, in the Preview environment, and waits until it succeeds: up to 10 minutes, or preview-timeout seconds.
  • When the repository deploys several Vercel projects, name the one to test with preview-project, for example preview-project: web.
  • When Vercel deployed the commit but recorded no GitHub deployment, it stops at once and tells you to turn on deployment_status Events (step 1).
  • A BASE_URL your workflow sets itself wins.
  • When Peeps starts the workflow to fix a failed test, the fix runs on the preview of the commit it checked out, so a pull request’s failure is fixed against that pull request’s own preview.
On your default branch, test your production domain (PRODUCTION_URL above, an Actions variable). A production deployment’s own URL is behind Deployment Protection too; the domain is not. Point your Playwright config at BASE_URL:
playwright.config.ts

3. Get through Deployment Protection

Vercel’s Standard Protection sends every visitor of a preview to Log in to Vercel. Your tests are visitors too. When they hit it, every test fails on the login page, and Peeps’ failure analysis says the preview’s Deployment Protection stopped the test. Let your CI through with a Trusted Source. Nothing is stored: each job proves which repository it runs in with its own short-lived GitHub token.
1

Add the trusted source

In Vercel, open your project, then Settings > Deployment Protection > Trusted Sources > Add trusted source > External Service. Choose GitHub Actions, your GitHub account, and the repository whose workflow runs the tests. Keep the default audience, https://github.com/<your account>, and the Preview environment. Click Add.
2

Send the token from your tests

A job with id-token: write can request its own GitHub token at any time. Each one lasts five minutes, and Vercel sets no cookie for it, so request it in the test process, send it as the x-vercel-trusted-oidc-idp-token header on every request to the deployment under test, and renew it before it expires:
tests/fixtures.ts
Import test and expect from this file in your specs instead of from @playwright/test. The token goes only to the deployment under test, never to another site the page loads from.
The repository in the trusted source must be the one the workflow runs in. A source for another repository, even your organization’s main one, does not let these jobs through.
Or use a bypass secret. Under Protection Bypass for Automation, click Add Secret, save the value as the repository secret VERCEL_AUTOMATION_BYPASS_SECRET, and send it as the x-vercel-protection-bypass header in the same fixture. Unlike the trusted source’s token it does not expire, and Playwright traces record request headers, so set trace: "off" while it is set.

Pull request tests

On the project’s Repository settings page, under Pull request tests:
  1. Choose the Smoke tests: a selection of the tests every pull request runs. Tests the pull request adds run too.
  2. Under On a pull request, your tests run against, choose That pull request’s own build.
Peeps then records each run against the URL your workflow tested, so a run’s page shows which preview it ran on. Once a pull request has run, the checklist there also shows two Vercel rows:
  • Vercel tells GitHub where each preview is: ticked when Vercel recorded a GitHub deployment for the pull request’s commit. If Vercel built it without one, the row tells you to turn on deployment_status Events (step 1).
  • Pull requests test their own Vercel preview: ticked when the pull request’s tests ran against a Vercel deployment. If not, the row tells you to add preview: vercel (step 2).
When a run’s analysis finds the test stopped on Vercel’s login, it says so and doesn’t suggest changing the test: fix the trusted source (step 3) and run it again.

Troubleshooting

Known limits

  • The fix assistant in Peeps can’t open a protected preview. It runs in Peeps, not in your CI, so your workflow’s trusted-source token doesn’t reach it, and Peeps sends your project’s HTTP headers only to your environments’ URLs. It can still read the run’s evidence; to look at the preview itself, open it in your browser.
  • A fork’s pull request is not tested on its preview. preview: vercel refuses pull requests from forks and pull_request_target, because a fork’s preview runs the fork’s code.