Skip to content

Run after a deploy

To test the build you just shipped, point the run at the deployed URL instead of a fixed one. The action passes the URL as a per-run config value, so the same test file works for every preview and environment. This guide covers the GitHub-native triggers. For Vercel, also read Load test a Vercel app.

The test reads the target from a config value. Bind it in the test file and use it in the script:

config: ["TARGET_URL"]
// perf/checkout/script.js (k6)
const base = __ENV.TARGET_URL;

The workspace needs a config value named TARGET_URL. Its stored value is the default. The action replaces it for the run with whatever you pass in config-overrides.

Hosts that create GitHub deployments for your repository send a deployment_status event when the deploy finishes:

name: perf-after-deploy
on: deployment_status
permissions:
contents: read
jobs:
load-test:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: MaxoPerf/github-action@v1
with:
api-key: ${{ secrets.MAXOPERF_API_KEY }}
account-id: ${{ vars.MAXOPERF_ACCOUNT_ID }}
config-overrides: TARGET_URL=${{ github.event.deployment_status.environment_url }}

The if line matters: GitHub sends an event for every state change (pending, in_progress, success, failure). Only success carries a usable URL. The action records deployment.sha and the deployment environment on the run.

Some hosts call GitHub’s dispatch API and put the URL in the payload:

on:
repository_dispatch:
types: [vercel.deployment.success]
jobs:
load-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: MaxoPerf/github-action@v1
with:
api-key: ${{ secrets.MAXOPERF_API_KEY }}
account-id: ${{ vars.MAXOPERF_ACCOUNT_ID }}
config-overrides: TARGET_URL=${{ github.event.client_payload.url }}

Check your host’s event type name and whether client_payload.url includes the https:// prefix. If it does not, write TARGET_URL=https://${{ github.event.client_payload.url }}.

The toggle on the GitHub Actions tab switches the workflow between pull request and after deploy.

Put one KEY=VALUE per line:

config-overrides: |
TARGET_URL=${{ github.event.deployment_status.environment_url }}
RELEASE=${{ github.sha }}

Rules for overrides:

  • Keys look like environment variable names, and you can pass up to 50.
  • A key that matches a bound secret, starts with MAXOPERF_, or is injected by a dependency is rejected. Secrets are never overridable.
  • Values are stored on the run and returned by the API. Do not put tokens in them.

The run’s CI chip shows the repository, commit and Action as the source. If the deploy URL is wrong or the site is not ready yet, the run fails on its criteria like any other, so give the deploy a moment to warm up or add a short readiness step before the action.

If your pipeline is GitLab, Jenkins or another CD tool, use the CLI with --config TARGET_URL=..., or call a deploy hook with curl.