CI/CD Integration
Trigger scans and runs from any CI. Token setup, full payload, GitHub PR sticky comments, commit status checks, smart test selection.
CI/CD Integration
Trigger AegisRunner scans and test runs from any CI pipeline — GitHub Actions, GitLab CI, CircleCI, Jenkins, anything that can make an HTTP request. This guide walks through setting up a token, the trigger payload, language-specific examples, and the GitHub PR comment integration.
How it works
- Generate a project-scoped CI trigger token from the project page.
- Store the token as a CI secret.
- POST to
/api/v1/ci/triggerwith the token in theAuthorizationheader. - The endpoint queues the run and returns a run ID. You can poll for completion or pass
wait: trueand let the request block. - Optionally, AegisRunner posts a sticky comment on the GitHub PR when the run finishes.
Generating a token
- Open the project, click the Integrations tab.
- Click the CI/CD sub-tab.
- Click Create Token, give it a name (e.g. "GitHub Actions — main branch").
- Copy the token immediately. It's shown once and only once.
- Add it to your CI provider's secret store (e.g.
AEGIS_CI_TOKENin GitHub Actions secrets).
Tokens are project-scoped — a token for project A can't trigger runs in project B. Tokens have no expiry by default but can be revoked from the same screen.
The trigger endpoint
POST /api/v1/ci/trigger
Authorization: Bearer aegis_<token>
Content-Type: application/json
Request body
| Field | Type | What it does |
|---|---|---|
suiteIds | string[] | Specific test suites to run. Omit to run all suites in the project. |
caseIds | string[] | Specific test cases to run (rather than full suites). Useful for re-running a known failing test. |
browserProfile | string | chromium (default), firefox, or webkit. Use multiple HTTP calls if you want all three. |
environmentId | string | Run against a specific environment (Pro+). |
testDataSetId | string | Use a specific test-data set instead of the project default. |
wait | boolean | If true, the request blocks until the run finishes (up to 10 min). Useful for pipeline failure signaling. Default false — caller polls the run status. |
crawl | boolean | If true, scan the site first, then run tests against the freshly-discovered pages. Useful for preview deploys where the URL changes per build. |
crawlPages | string[] | If only specific pages need re-scanning, list them here. |
baseUrl | string | Override the project's base URL — for preview deployments (https://pr-123.preview.example.com). |
generateTests | boolean | Re-generate AI tests for crawled pages before running. |
selectionStrategy | string | Smart test selection: changed, flaky, recent. See Smart Test Selection. |
maxPages / maxDepth | int | Override scan caps when crawl: true. Defaults to last scan's settings. |
device | string | desktop or mobile. Defaults to project's last scan. |
fillForms / respectRobots | boolean | Scan options. |
githubRepo | string | For PR comments — owner/name. |
githubPrNumber | int | PR to comment on. |
githubCommitSha | string | Commit SHA — used for status checks. |
githubToken | string | GitHub PAT or App token for posting the comment. Request-scoped, never stored. |
Response
{
"runId": "019e4...",
"status": "queued",
"runType": "manual",
"url": "https://aegisrunner.com/runs/019e4..."
}
GitHub Actions example
name: AegisRunner
on:
pull_request:
branches: [main]
jobs:
aegis-tests:
runs-on: ubuntu-latest
steps:
- name: Trigger AegisRunner run
run: |
curl -fsSL -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer aegis_${{ secrets.AEGIS_CI_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"crawl": true,
"baseUrl": "https://pr-${{ github.event.pull_request.number }}.preview.example.com",
"wait": true,
"githubRepo": "${{ github.repository }}",
"githubPrNumber": ${{ github.event.pull_request.number }},
"githubCommitSha": "${{ github.event.pull_request.head.sha }}",
"githubToken": "${{ secrets.GITHUB_TOKEN }}"
}'
With wait: true, the curl call exits non-zero if the run fails — your pipeline fails as expected.
GitLab CI example
aegis-tests:
stage: test
image: alpine:latest
before_script:
- apk add --no-cache curl
script:
- |
curl -fsSL -X POST https://aegisrunner.com/api/v1/ci/trigger \
-H "Authorization: Bearer aegis_$AEGIS_CI_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"baseUrl\": \"$CI_ENVIRONMENT_URL\",
\"crawl\": true,
\"wait\": true
}"
only:
- merge_requests
Polling for status
If you don't pass wait: true, the trigger returns immediately. Poll the status endpoint:
GET /api/v1/ci/runs/<runId>
Authorization: Bearer aegis_<token>
Returns the run's status, pass/fail counts, duration, and a link to the run page. Common pattern: a CI step that polls every 10 seconds for up to 10 minutes, exiting non-zero if the run failed or didn't finish.
GitHub PR comments
When you include githubRepo, githubPrNumber, and githubToken, AegisRunner posts a sticky comment on the PR after the run completes. The comment includes:
- Pass/fail summary with counts.
- Link to the run page.
- Top failing tests (if any), with one-line failure reasons.
- Visual regression diffs if any were rejected.
The comment is sticky — re-running on the same PR updates the existing comment rather than spamming new ones.
${{ secrets.GITHUB_TOKEN }} works for public repos. For private repos and stricter permissions, use a personal access token or a GitHub App installation token. The token is request-scoped and never persisted.
Commit status checks
When you also pass githubCommitSha, AegisRunner publishes a commit status (aegisrunner) that turns the green checkmark in the PR view into a red X if the run fails. Combine with branch protection rules to block merges on failure.
Smart test selection
For large suites, running everything on every PR gets expensive. Use selectionStrategy to run only the tests that matter:
- changed — run tests covering the files changed in the PR (requires git diff payload).
- flaky — run only known-flaky tests, useful for stability sweeps.
- recent — run tests created or edited in the last N days.
See Smart Test Selection.
Environment variables in scripts
Login scripts and tests can reference values from Test Environment → Tokens with {{TOKEN_NAME}} syntax. CI can override these per-trigger by passing them in environmentId (Pro+) or directly via the trigger payload.
Plan limits
| Plan | CI tokens per project | API rate limit |
|---|---|---|
| Free | 1 | 100 req/min |
| Starter | 3 | 200 req/min |
| Pro | 10 | 500 req/min |
| Business | Unlimited | 1,000 req/min |
| Enterprise | Unlimited | Unlimited |
Common questions
How do I rotate a token?
Create a new one, update your CI secret, then revoke the old one. Tokens don't auto-rotate.
Can one CI run trigger multiple browsers?
Yes — make three separate POST calls with different browserProfile values, in parallel CI jobs. Each gets its own run ID.
The PR comment isn't appearing.
Check the run logs. Usually the GitHub token has insufficient scope — needs pull_requests: write for App tokens, or repo for classic PATs.
Related
- Deployment Webhooks — auto-trigger on Vercel / Netlify / GitLab deploys.
- Smart Test Selection — run fewer tests per PR.
- Baseline Replays — deterministic CI runs.
- Notifications & Alerts — get failures into Slack on top of PR comments.