ReferenceIntegrationsVercel

run-with-vercel-deployment action

Every input and output of the run-with-vercel-deployment GitHub Action, how it authenticates, and how it gets past Vercel Deployment Protection.

endformdev/actions/run-with-vercel-deployment waits for the Vercel deployment of the current commit, exports its URL, and sets up Endform to get past Vercel Deployment Protection. Endform links a GitHub Actions job to a Vercel deployment only when the job runs this action before npx endform@latest test.

.github/workflows/endform-e2e.yml (excerpt)
permissions:
  contents: read
  id-token: write

steps:
  - name: Wait for Vercel deployment
    uses: endformdev/actions/run-with-vercel-deployment@main
    with:
      project-name: your-vercel-project-name
      set-url-env-var: BASE_URL

  - name: Run Playwright suite on Endform
    run: npx endform@latest test

Inputs

InputRequiredDefaultDescription
project-nameOne of project-name or project-idVercel project name, as shown in Vercel and in .vercel/project.json when the project is linked locally.
project-idOne of project-name or project-idVercel project ID, such as prj_abc123. Use it to identify the project by an ID that doesn't change when the project is renamed.
set-url-env-varYesName of the environment variable that receives the ready deployment URL, such as BASE_URL. Match the variable that use.baseURL reads in playwright.config.ts.
set-vercel-bypass-env-varNoName of an environment variable that receives the raw Deployment Protection bypass token, such as VERCEL_BYPASS_TOKEN. Only needed for requests made outside Playwright. See Direct fetch calls.
deployment-protection-bypassNotrueWhether to request a Deployment Protection bypass token. Set it to false if your previews aren't protected or you handle the bypass yourself.
timeout-secondsNo600How long to wait for the deployment to be ready before failing the step. Raise it for builds that take longer than 10 minutes.

Outputs

Later steps in the same job can read these with steps.<step-id>.outputs.<name>:

OutputDescription
deployment-urlThe ready deployment URL. This is the same value exported in set-url-env-var.
deployment-idThe Vercel deployment ID.
messageA status message, currently Deployment ready.

Authentication

The action authenticates through GitHub OIDC only:

  • The workflow needs id-token: write (and contents: read) in permissions.
  • The repository needs the Endform GitHub App installed, from the same Endform organization as the Vercel integration.
  • Don't pass ENDFORM_API_KEY for this flow.

Deployment Protection bypass

When your Vercel project protects its previews, the action fetches a bypass token for the deployment and passes it to Endform as an x-vercel-protection-bypass header in ENDFORM_EXTRA_HTTP_HEADERS.

Playwright browser contexts and request fixtures send the header automatically, so your tests need no changes.

Direct fetch calls

Requests that don't go through Playwright, such as plain fetch calls in a global setup that creates test users, don't get the header. Set set-vercel-bypass-env-var in the action:

with:
  project-name: your-vercel-project-name
  set-url-env-var: BASE_URL
  set-vercel-bypass-env-var: VERCEL_BYPASS_TOKEN

Then send the header on those requests when the variable is set:

const headers = new Headers();
if (process.env.VERCEL_BYPASS_TOKEN) {
  headers.set("x-vercel-protection-bypass", process.env.VERCEL_BYPASS_TOKEN);
}

The variable is only set when the action requested a bypass token and Vercel returned one.

Other custom headers

ENDFORM_EXTRA_HTTP_HEADERS replaces extraHttpHeaders in endform.config.ts instead of merging with it. Define any other custom browser headers in playwright.config.ts (use.extraHTTPHeaders) so both apply.

Last updated