Skip to content

Deployment Accessibility Checks #1

Deployment Accessibility Checks

Deployment Accessibility Checks #1

Workflow file for this run

name: Deployment Accessibility Checks
on:
push:
branches:
- gh-pages
workflow_dispatch:
env:
PRODUCTION_URL: "https://data6.org/notes/"
# must match the end of PRODUCTION_URL
# leave blank if at root
SITE_SUBDIR: "notes"
jobs:
axe-audit:
runs-on: ubuntu-latest
steps:
# 1. Checkout Code
- name: Checkout repository
uses: actions/checkout@v4
# 2. Setup Node.js (for Axe and http-server)
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
# 3. Install Tools
- name: Install Axe and Server
run: npm install -g @axe-core/cli http-server
# 4. Start Local Server (Background Process)
- name: Start Local Server
run: |
# Serve the contents on port 3000.
npx http-server ./ -p 3000 > /dev/null 2>&1 &
sleep 5
# 7. Run Axe Scan
- name: Run Accessibility Scan
id: axe-scan
run: |
# Swap the Production URL for Localhost + Subdirectory
# e.g. https://data6.org/notes -> http://localhost:3000/notes
LOCAL_URL="http://localhost:3000/${{ env.SITE_SUBDIR }}"
URLS=$(cat sitemap.xml | \
sed -n 's/.*<loc>\(.*\)<\/loc>.*/\1/p' | \
sed "s|${{ env.PRODUCTION_URL }}|$LOCAL_URL|" | \
tr '\n' ' ')
echo "Scanning the following pages:"
echo "$URLS"
# Run Axe
axe $URLS \
--tags wcag2a,wcag2aa,wcag21a,wcag21aa \
--save axe-report.json \
--exit
# 8. Upload Report (Runs even if Step 7 fails)
- name: Upload Accessibility Report
if: always()
uses: actions/upload-artifact@v4
with:
name: axe-report
path: axe-report.json