Block WCAG regressions in pull requests
Catch broken contrast, missing labels, and invalid ARIA on preview deploys without blocking merges on legacy debt. Capped at ≤20 URLs per run so builds finish in under 45 seconds.
JoeAzar/a11ydrift-action) ahead of GitHub Marketplace listing. Paid workspaces can already integrate baseline-diff CI results directly via POST /api/scans/ci using an API key from Workspace Settings.Standalone Action
Runs Playwright + axe-core on GitHub Actions runners with baseline diffing and OASIS SARIF 2.1.0 Code Scanning output.
Baseline-diff only
Commit a11ydrift-pr-report.json to .a11ydrift/baseline.json (or sync via api-key) so checks fail only on new regressions.
Capped monthly runs
Paid workspaces include fixed monthly caps: 100 runs/mo (Starter), 500 (Agency), or 2,000 (Scale) at ≤20 URLs/run.
Quickstart workflow
Save as .github/workflows/a11y-gate.yml and replace PREVIEW_URL with your staging or preview deployment URL.
name: A11yDrift WCAG 2.2 AA PR Gate
on:
pull_request:
branches: [main]
permissions:
contents: read
pull-requests: write
security-events: write
jobs:
a11y-pr-gate:
runs-on: ubuntu-latest
env:
# Replace with your Vercel, Netlify, or Cloudflare Pages preview URL
PREVIEW_URL: https://staging.your-app.com
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run A11yDrift PR check
uses: JoeAzar/a11ydrift/apps/github-action@main
with:
base-url: ${{ env.PREVIEW_URL }}
# Up to 20 preview URLs or relative paths (hard cap: 20)
urls: |
/
/pricing
/products/sample-item
/checkout
max-urls: "20"
fail-on: serious
# Optional: ignore known issues so only new regressions fail the build
baseline-file: .a11ydrift/baseline.json
# Optional: omit for free public-repo checks; add api-key for workspace sync
api-key: ${{ secrets.A11YDRIFT_API_KEY }}
api-url: https://a11ydrift.com/api/scans/ci
domain-id: ${{ vars.A11YDRIFT_DOMAIN_ID }}
comment-on-pr: "true"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload SARIF to GitHub Code Scanning
if: always() && hashFiles('a11ydrift-pr-report.sarif') != ''
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: a11ydrift-pr-report.sarif
category: a11ydrift-wcag-22-aaWhat appears on your PR
Each push updates one comment in place, listing new regressions and collapsing baseline issues.
GitHub Code Scanning (OASIS SARIF 2.1.0)
Every run writes a11ydrift-pr-report.sarif (OASIS SARIF 2.1.0) alongside the JSON report—keep security-events: write and the final SARIF upload step in the quickstart workflow above to surface regressions in the Security tab and PR Code Scanning checks.
Inputs
| Input | Required | Default | Description |
|---|---|---|---|
| urls | Yes | — | Newline- or comma-separated preview URLs (or relative paths when base-url is set). Hard cap of 20 URLs per run. |
| base-url | No | "" | Optional base URL prefix (e.g. https://staging.your-app.com) applied to relative paths in urls. |
| max-urls | No | 20 | Maximum URLs per run (hard ceiling: 20). Counts over 20 fail fast to keep CI predictable. |
| fail-on | No | serious | Minimum severity that fails the PR check: critical | serious | moderate | minor | none. |
| baseline-file | No | "" | Path to a JSON baseline of known fingerprints (e.g. .a11ydrift/baseline.json as a string array, { fingerprints }, or a prior a11ydrift-pr-report.json). |
| api-key | No | "" | Workspace API key from /dashboard/settings. Not needed on public repos; syncs baselines and tracks private-repo quotas. |
| api-url | No | https://a11ydrift.com/api/scans/ci | CI sync endpoint used when api-key is set. |
| domain-id | No | "" | Verified A11yDrift domain ID linked to this repo when api-key is set. |
| comment-on-pr | No | true | Post or update a single accessibility comment on the pull request (true | false). |
| github-token | No | ${{ github.token }} | GitHub token used to post or update PR comments. |
Outputs
| Output | Description |
|---|---|
| new-regressions | Count of new WCAG 2.2 AA regressions compared to your baseline. |
| total-clusters | Total deduplicated template clusters across scanned URLs. |
| raw-violations | Raw page-level axe-core errors before template deduplication. |
| noise-reduction-pct | Percentage of raw errors collapsed into template clusters. |
| report-path | Path to the generated JSON report (a11ydrift-pr-report.json), reusable directly as a baseline-file. A companion OASIS SARIF 2.1.0 file (a11ydrift-pr-report.sarif) is written alongside it. |
14 baseline issues collapsed (not blocking merge)
.a11ydrift/baseline.json. Fix legacy issues on your own schedule and refresh the baseline fromoutputs.report-path.