Configuration
Every input and output of the GetWCAG GitHub Action, with examples for the most common setups.
Choose which pages are checked#
Pages are found automatically. Pin the ones that matter most and leave out the ones that don't need checking:
- uses: GetWCAG-App/scan-action@v1
with:
api-key: ${{ secrets.GETWCAG_API_KEY }}
start: npm start
pages: /checkout, /signup
exclude: /admin, /preview/*Pinned pages count toward your plan's pages per run, so pin a few, not dozens. See How pages are chosen.
Set pages in GetWCAG instead
People who don't edit the repository, like QA or an accessibility lead, can set the same lists in the app. Open your project, go to CI checks, select Settings and fill in:
- Always check: exact pages, one per line, like
/checkout. They're checked first. - Never check: paths to leave out, like
/admin, which also covers the pages under it. A*matches anything.
The lists apply from the next run, to every repository that uses the project. They're added to pages and exclude in the workflow, so both places count, and a page on either never list is never checked. The pull request comment says when lists from GetWCAG were used. Each list holds up to 50 paths. See Settings.
Ignore third-party elements#
A cookie banner, chat widget or embedded video from another company can change without anyone on your team touching it, and its issues would show up as new on your next pull request. Leave them out with ignore:
- uses: GetWCAG-App/scan-action@v1
with:
api-key: ${{ secrets.GETWCAG_API_KEY }}
start: npm start
ignore: "#cookie-banner, .chat-widget, iframe[src*='youtube']"Use any CSS selector, separated by commas or one per line. Everything inside a matched element is skipped too. The pull request comment lists what was ignored, so it's never hidden.
Use it for code you can't change
Ignored elements aren't checked at all. For your own code, fix the issue, or dismiss it in GetWCAG with a reason. After you change ignore, issues in newly ignored elements show as fixed on the next run.
Check a staging or preview URL#
If your app is already deployed somewhere, skip start and pass the URL. The check runs against that URL from the CI machine.
- uses: GetWCAG-App/scan-action@v1
with:
api-key: ${{ secrets.GETWCAG_API_KEY }}
url: https://staging.example.comVercel preview deployments
Run on deployment_status and pass the preview URL. If your previews are protected, add the protection bypass secret as a header.
on: deployment_status
jobs:
getwcag:
if: github.event.deployment_status.state == 'success'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: GetWCAG-App/scan-action@v1
with:
api-key: ${{ secrets.GETWCAG_API_KEY }}
url: ${{ github.event.deployment_status.environment_url }}
headers: |
x-vercel-protection-bypass: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}Sites with a language prefix
If your home page redirects to /en or another language, wait for that page instead. Pages are still checked on the same origin.
start: npm start
wait-for: http://localhost:3000/enInputs#
| Input | Default | What it does |
|---|---|---|
api-key | None | Your project's CI key. Required. Store it as a secret. |
pages | None | Pages always checked first, one per line or comma separated, like /checkout, /signup. |
discover | true | Find the other pages from your sitemap and links. false checks only pages (or / if empty). |
exclude | None | Paths never to check, like /admin, /preview/*. A * works as a wildcard. |
per-template | 2 | How many pages of each kind to check, 1 to 10. |
ignore | None | Elements never to check, as CSS selectors, like #cookie-banner, .chat-widget. Everything inside them is skipped too. |
hide-text | false | Leave all page text and free-text attributes out of what's sent and shown. For pages with personal data. |
url | None | Base URL to check, like a staging or preview URL. Leave empty when you use start. |
start | None | Command that starts your app on the CI machine, like npm start. Runs in the background. |
wait-for | http://localhost:3000 | URL to wait for before checking. Can be a page, like http://localhost:3000/en. Pages are checked on its origin. |
wait-timeout | 120 | Seconds to wait for your app to answer, 1 to 1800. |
fail-on | serious | Fail on new issues at this level or worse: critical, serious, moderate, minor or none. |
headers | None | Extra request headers, one Name: value per line. Sent only to your site, never to GetWCAG or anyone else. |
comment | true | Comment on the pull request. Needs the pull-requests: write permission. |
fail-on-error | false | Fail when GetWCAG can't finish, for example when it can't be reached. By default it only warns. |
github-token | github.token | Token used for the pull request comment. |
Turning hide-text on or off
hide-text changes what issues are matched on, so reset the baseline in the CI checks tab after you change it. Otherwise the next pull request shows every issue as new.
Outputs#
| Output | Value |
|---|---|
result | passed, failed, skipped or error |
run-id | The GetWCAG run ID |
new-issues | Number of new issues |
fixed-issues | Number of fixed issues |
Use them in later steps, for example to post to Slack:
- uses: GetWCAG-App/scan-action@v1
id: getwcag
with:
api-key: ${{ secrets.GETWCAG_API_KEY }}
start: npm start
- if: always()
run: echo "New issues: ${{ steps.getwcag.outputs.new-issues }}"