Skip to content
Tallyn

Docs · Integrate in CI

Catch a regression before it ships

Run an audit on your key pages in the pipeline, and fail the build when a page picks up a critical barrier. The recipe below is ready to adapt.

Step 1

Add the workflow

Store your Tallyn token as a repository secret named TALLYN_TOKEN, then drop this file at .github/workflows/accessibility.yml.

.github/workflows/accessibility.yml
name: accessibility
on: [pull_request]

jobs:
  tallyn:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: 20
      - name: Audit key pages with Tallyn
        env:
          TALLYN_TOKEN: ${{ secrets.TALLYN_TOKEN }}
        run: node scripts/tallyn-audit.mjs

Step 2

Add the audit script

This lists the pages to check, audits each one, prints the score and any critical issues, and exits non-zero if a page has one, which fails the build.

scripts/tallyn-audit.mjs
// scripts/tallyn-audit.mjs
// Audits a list of URLs and fails the build if any page
// has a critical accessibility issue.
const PAGES = [
  "https://staging.example.com/",
  "https://staging.example.com/checkout",
];

const token = process.env.TALLYN_TOKEN;
if (!token) throw new Error("Set TALLYN_TOKEN");

let failed = false;

for (const url of PAGES) {
  const res = await fetch("https://tallynaccess.com/api/v1/audit", {
    method: "POST",
    headers: {
      "content-type": "application/json",
      authorization: `Bearer ${token}`,
    },
    body: JSON.stringify({ url }),
  });

  if (!res.ok) {
    console.error(`${url}: audit failed (${res.status})`);
    failed = true;
    continue;
  }

  const { score, issues } = await res.json();
  const critical = issues.filter((i) => i.severity === "critical");

  console.log(`${url}: score ${score}, ${critical.length} critical`);
  for (const issue of critical) {
    console.error(`  ${issue.title} (${issue.wcag_reference})`);
  }
  if (critical.length > 0) failed = true;
}

process.exit(failed ? 1 : 0);

Programmatic access with a token is a Business-plan feature. On Team, audit pages from the dashboard and re-check after a fix. The audit runs the same engine either way, so the report in CI matches the report on the site. See plans.