gh-a11y
Audit web accessibility
TLDR
View documentation for the original command
SYNOPSIS
gh a11y check pr-number | pr-url [options]
gh a11y run [options]
gh a11y command [flags]
PARAMETERS
--pr
Specify the pull request number or URL to analyze.
--repo
Specify the GitHub repository (e.g., octocat/Spoon-Knife).
--comment
Post accessibility results as a comment directly on the pull request.
--web-report
Generate a detailed HTML accessibility report with the findings.
--fail-on-issue
Exit with a non-zero status code if any accessibility issues are detected.
--json
Output the accessibility results in a machine-readable JSON format.
--verbose
Enable verbose logging, useful for debugging and detailed output.
--only-changes
Limit the scan to only the files that have been modified in the pull request.
--tags
Comma-separated list of axe-core tags (e.g., wcag2a,wcag21aa) to include in the scan.
--exclude-tags
Comma-separated list of axe-core tags to exclude from the scan.
--rules
Comma-separated list of specific axe-core rules to include.
--exclude-rules
Comma-separated list of specific axe-core rules to exclude.
DESCRIPTION
gh-a11y is a GitHub CLI extension that helps contributors and maintainers identify accessibility issues in pull requests before they are merged. It scans the rendered HTML of a pull request's changed files using tools like axe-core. The extension can be configured to run automatically as a GitHub Action or manually via the CLI, providing feedback directly in the PR timeline. Its primary goal is to shift left accessibility testing, making it easier to catch and fix issues early in the development cycle, thereby improving the overall accessibility of web projects hosted on GitHub.
CAVEATS
Requires a headless browser (like Chromium/Chrome) to be installed and accessible on the system. It also relies on a GitHub token with sufficient permissions (e.g., pulls scope for commenting) to interact with repositories. Performance might vary with the size and complexity of the pull request changes.
INSTALLATION
To install gh-a11y, use the GitHub CLI extension command:
gh extension install github/gh-a11y
INTEGRATION WITH GITHUB ACTIONS
gh-a11y can be seamlessly integrated into a project's CI/CD pipeline as a GitHub Action, enabling automated accessibility checks on every pull request, providing immediate feedback to contributors.
UNDERLYING TECHNOLOGY
The extension uses axe-core, a leading accessibility testing engine, to evaluate HTML against a set of accessibility rules. It renders the pull request's HTML content in a headless browser (e.g., Chromium) to perform dynamic analysis.
HISTORY
gh-a11y was developed by GitHub to address the growing need for earlier detection of accessibility issues in the software development workflow. Its creation leverages the extensibility of the GitHub CLI, providing a native and integrated experience for developers. It represents GitHub's commitment to fostering accessible development practices, aiming to empower teams to build more inclusive web applications by embedding accessibility checks directly into the pull request review process.


