Workflow: .github/workflows/a11y.yaml
Serves a built static site from an artifact and scans it with pa11y-ci. Its job reports as the pa11y check; called from a job named a11y, it appears as a11y / pa11y. It isn't Hugo-specific: any earlier job in the same run can upload the site.
| Input | Default | Purpose |
|---|---|---|
artifact |
required | Artifact holding the built site |
pa11y-config |
.pa11yci.js |
pa11y-ci config path |
node-version |
24 |
Node.js version for pa11y-ci |
port |
4173 |
Local port to serve the site on |
The calling repo needs:
package.jsonandpackage-lock.jsonwithpa11y-ciandserveas dev dependencies. The workflow runs them withnpx --no-install, so their versions come from your lockfile.- A pa11y-ci config that scans the served site. The workflow sets
SITE_URL(http://localhost:4173/by default) for the pa11y-ci step, so read it withprocess.env.SITE_URLin a.pa11yci.js. Build the site with the same address as its base URL. SetchromeLaunchConfig.executablePathfrom theCHROME_PATHenvironment variable; the workflow points it at the runner's Chrome and skips Puppeteer's download.
For a full caller that builds a Hugo site and scans it, see the Hugo CI example.