Update accessibility-scan.yml #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow uses actions to scan for accessibility | |
name: Accessibility Scan | |
on: [push, pull_request] | |
jobs: | |
accessibility: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '14' | |
- name: Install dependencies | |
run: npm install | |
- name: Install axe-cli and http-server | |
run: npm install -g axe-cli http-server | |
- name: Start local server | |
run: | | |
nohup http-server ./ & | |
- name: Wait for the server to start | |
run: sleep 5 # Wait for 5 seconds to ensure server is ready | |
- name: Create axe-reports directory | |
run: mkdir -p ./axe-reports | |
- name: Run axe-cli accessibility scan without output path | |
run: | | |
npx axe-cli http://localhost:8080 | |
echo "Report should be generated in the default location." | |
- name: Verify report creation | |
run: | | |
ls -la ./axe-reports/ | |
if [ -f ./axe-reports/accessibility-report.html ]; then | |
cat ./axe-reports/accessibility-report.html | |
else | |
echo "Report not created" | |
fi | |
- name: Upload axe-core report | |
uses: actions/upload-artifact@v3 | |
with: | |
name: axe-report | |
path: ./axe-reports/accessibility-report.html | |