Accessibility testing in GitHub Actions: a working workflow in five minutes
Most accessibility checks in CI are assembled by hand from blog posts and abandoned the first week they go red. This is the short path to one that stays switched on, in five steps.
What you end up with
A job that runs on every pull request, scans the URLs you give it with axe-core, and goes red only when a violation appears that is not already in a committed baseline file. On the pull request your team sees a check, one comment listing the new violations by rule, impact, page and selector (edited in place on each push, not posted again), annotations on the run, and a job summary with the same report.
It needs a page the scanner can reach from the internet: a staging site, a preview
deployment or production. Pages on localhost or behind a sign-in are covered at the end.
1. Get a key
Sign up with an email address and a password and confirm the six-digit code.
The welcome flow creates your first key. It looks like skl_live_… and is shown once;
only a hash is stored, so if you lose it you revoke it and create another. The free plan
is 500 scans a month and needs no card.
2. Store it as a repository secret
In the repository, go to Settings → Secrets and variables → Actions and add a secret
called SKIPLINK_TOKEN. With the GitHub CLI:
gh secret set SKIPLINK_TOKEN
Never put the key in the workflow file. Anyone who can read the repository could then spend your quota.
3. Record a baseline before the first run
Skip this and the first run fails on everything the scan finds, which on a site that has been live for a while is usually dozens of violations. Run it once, locally:
export SKIPLINK_TOKEN=skl_live_…
npx @skiplink/cli scan https://staging.example.com \
--baseline .skiplink/baseline.json --update-baseline
git add .skiplink/baseline.json
git commit -m "Accept existing accessibility violations"
The CLI needs Node 20 or later and nothing else. Read the file before you commit it: every entry is a violation the gate will now ignore, and reviewing that list is the point of keeping it in the repository. If the CLI warns that the page answered with a 4xx or 5xx status, stop and fix the URL first, or the baseline will describe an error page. Why this works on a site with years of history is covered in checks in CI on an existing site.
4. Add the workflow
# .github/workflows/a11y.yml
name: Accessibility
on: pull_request
jobs:
a11y:
runs-on: ubuntu-latest
permissions:
pull-requests: write # for the report comment
steps:
- uses: actions/checkout@v4
- uses: skiplink/action@v1
with:
urls: https://staging.example.com
baseline: .skiplink/baseline.json
token: ${{ secrets.SKIPLINK_TOKEN }}
The checkout step is there so the Action can read the baseline file. The
pull-requests: write permission is only for the comment; without it the job summary
still carries the report.
The Action runs the same npm package you ran in step 3, so it needs Node 20 or later.
ubuntu-latest already has it. On a self-hosted runner without Node, add
actions/setup-node before this step.
5. Open a pull request
Push the workflow on a branch and open a pull request. The check should go green: nothing
has changed since you recorded the baseline. To see it fail, add something the rules
catch, an <img> with no alt or a <button> containing only an icon, deploy it to the
URL being scanned, and push again.
That is the whole set-up. What follows is what to change once it is running.
Every input
These are the Action's inputs, as listed on the integration page.
| Input | Default | Notes |
|---|---|---|
urls | — | Required. One per line, or space-separated. |
token | — | Required. Store as a repository secret. |
baseline | — | Path to the committed baseline file. |
fail-on | new | new, critical, serious, moderate, minor, never |
standard | wcag22aa | Rule set. See the standards table. |
wait-for | — | CSS selector to wait for. For apps that render late. |
comment | true | Post and update the pull request comment. |
cli-version | latest | Pin for reproducible builds. |
Several pages go in urls as a block:
with:
urls: |
https://staging.example.com/
https://staging.example.com/pricing
https://staging.example.com/checkout
baseline: .skiplink/baseline.json
token: ${{ secrets.SKIPLINK_TOKEN }}
Pick one URL per template rather than every page. Each URL is one scan, on every push of every pull request, so three pages across ten pushes is thirty scans. The pricing page says exactly what counts.
Pin the version
cli-version defaults to latest, which is convenient on day one and wrong once you rely
on the gate. A new release can bring a newer axe-core with changed rules, and a finding
that appears because the scanner changed looks exactly like one your code introduced. Pin
it, and upgrade in a pull request of its own:
cli-version: "1.0.0"
Every result also reports the axe-core and Chromium versions that produced it, as
engine in the JSON, so a change in findings can be traced to a change in the engine.
Using the outputs
The Action sets three outputs: passed (true when the gate passed), new-violations
(the count not in the baseline) and report (the path to the markdown report). Give the
step an id to read them:
- uses: skiplink/action@v1
id: a11y
with:
urls: https://staging.example.com
baseline: .skiplink/baseline.json
token: ${{ secrets.SKIPLINK_TOKEN }}
- if: always()
env:
NEW: ${{ steps.a11y.outputs.new-violations }}
run: echo "New accessibility violations: $NEW"
Passing outputs through env rather than writing ${{ }} straight into the script is a
good habit in any workflow: it keeps a value from a previous step from ever being run as
shell.
Red, and could not complete
A red check means one of two different things, and the report says which. Either the scan found violations that are not in the baseline, or the scan could not run at all: the site was down, the key was rejected, or no page could be fetched. The CLI underneath uses separate exit codes for these (1 and 3), and a scan that could not run is never reported as a pass. Retrying makes sense for the second; for the first, it does not.
Pages this cannot reach
The scanner fetches each URL from the internet. It refuses localhost, private and
internal addresses, and ports other than 80 and 443, so a server started inside the job
on localhost:3000 is out of reach, as is anything behind a sign-in. For those, run the
same engine inside your end-to-end tests with the
Playwright adapter, which writes to the same baseline file.
Playwright behind a login walks through
it, and pull request previews
covers scanning a fresh preview URL on every pull request.
What a green check means
No automatically detectable violations were found that are not already in the baseline. Automated testing covers part of WCAG, not all of it: keyboard order, whether alt text describes the image and whether a custom widget behaves as its role promises still need a person. What a scan does not tell you has the detail.
Related
- Running accessibility checks on pull request preview deployments
- Adding accessibility checks to a site that already has violations
- Accessibility Testing GitHub Action
Try it on your own site: scan a URL for free, or read the docs to add a baseline to your pipeline.