Automatically scan HTML files for WCAG accessibility compliance using axe-core and Puppeteer. This action intelligently detects whether to scan the entire repository or only affected files based on the GitHub context.
- Smart Scanning: Automatically detects PR vs. main branch pushes
- PR Mode: Fast scans of only changed files
- Main Branch Mode: Comprehensive scans of entire repository
- WCAG 2.1 Compliance: Uses axe-core for thorough accessibility testing
- Multiple Output Formats: Generates both HTML and JSON reports
- Configurable: Customize scan mode, output directory, and more
- Repository must contain HTML files
- GitHub Actions enabled on your repository
- uses: mohammedfarhank/WCAG2.1-Scanner-github-action@main
with:
email: ${{ github.actor }}@company.com
name: ${{ github.actor }}- uses: mohammedfarhank/WCAG2.1-Scanner-github-action@main
with:
email: ${{ github.actor }}@company.com
name: ${{ github.actor }}
scan_mode: 'affected' # 'auto', 'all', or 'affected'
output_dir: './accessibility-reports'| Input | Description | Required | Default |
|---|---|---|---|
email |
Committer's email address | β Yes | ${{ github.actor }}@localhost |
name |
Committer's name | β Yes | ${{ github.actor }} |
scan_mode |
Scan mode: auto, all, or affected |
β No | auto |
output_dir |
Output directory for reports | β No | ./reports |
- Pull Requests: Scans only affected/changed files (fast)
- Direct pushes to main/master: Scans entire repository (comprehensive)
- Other contexts: Scans entire repository
- Forces full repository scan regardless of context
- Use for comprehensive accessibility audits
- Forces scan of only changed files
- Use for fast PR checks
The action generates:
- HTML Report: Interactive report with violations, incomplete results, and test coverage
- JSON Report: Machine-readable data for further processing
- Console Output: Real-time scanning progress and results
Reports are saved to the specified output directory:
reports/
βββ report.html # Interactive HTML report
βββ report.json # JSON data export
name: Accessibility Check
on: [pull_request]
jobs:
accessibility:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mohammedfarhank/WCAG2.1-Scanner-github-action@main
with:
email: ${{ github.actor }}@company.com
name: ${{ github.actor }}
scan_mode: 'affected'
- uses: actions/upload-artifact@v4
with:
name: accessibility-report
path: ./reports/name: Full Accessibility Audit
on:
push:
branches: [main, master]
jobs:
accessibility:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mohammedfarhank/WCAG2.1-Scanner-github-action@main
with:
email: ${{ github.actor }}@company.com
name: ${{ github.actor }}
scan_mode: 'all'
- uses: actions/upload-artifact@v4
with:
name: accessibility-report
path: ./reports/The scanner automatically excludes common build and dependency directories:
node_modules,dist,build,www.git,coverage,.angularios,android,platforms.idea,.vscode
- HTML files: Maximum 1000 files per scan
- Timeout: 120 seconds per file
- No HTML files found: Ensure your repository contains
.htmlfiles - Git diff failed: The action will fall back to full repository scan
- Puppeteer timeout: Large HTML files may take longer to process
Enable debug output by setting the ACTIONS_STEP_DEBUG secret to true in your repository.
- PR Mode: Typically 2-5x faster than full scans
- Main Branch Mode: Comprehensive coverage for regression detection
- Smart Fallbacks: Automatically handles errors and edge cases
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.