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.
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 testInputs
| Input | Required | Default | Description |
|---|---|---|---|
project-name | One of project-name or project-id | Vercel project name, as shown in Vercel and in .vercel/project.json when the project is linked locally. | |
project-id | One of project-name or project-id | Vercel 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-var | Yes | Name 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-var | No | Name 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-bypass | No | true | Whether to request a Deployment Protection bypass token. Set it to false if your previews aren't protected or you handle the bypass yourself. |
timeout-seconds | No | 600 | How 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>:
| Output | Description |
|---|---|
deployment-url | The ready deployment URL. This is the same value exported in set-url-env-var. |
deployment-id | The Vercel deployment ID. |
message | A status message, currently Deployment ready. |
Authentication
The action authenticates through GitHub OIDC only:
- The workflow needs
id-token: write(andcontents: read) inpermissions. - The repository needs the Endform GitHub App installed, from the same Endform organization as the Vercel integration.
- Don't pass
ENDFORM_API_KEYfor 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_TOKENThen 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.
Related pages
Last updated