Skip to content

Commit

Permalink
pa11y ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aloxe committed Feb 13, 2025
1 parent e730147 commit e7462c9
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/pa11y.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: '♿ Pa11y'
on: pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/setup-node@v3
with:
node-version: 20
- name: npm install, build
run: |
npm install
npm run build
- name: Run pa11y-ci.
run: npm run pa11y-ci:sitemap 2>&1 | tee pa11y_output.txt

- name: Read pa11y_output file.
id: pa11y_output
uses: juliangruber/read-file-action@v1
with:
path: ./pa11y_output.txt

- name: Comment on pull request.
uses: thollander/actions-comment-pull-request@master
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: '<details><summary>Pa11y testing results</summary>```${{ steps.pa11y_output.outputs.content }}```</details>'

- name: Check for pa11y failures.
if: contains(steps.pa11y_output.outputs.content, 'errno 2')
run: |
echo "::error::The site is failing accessibility tests. Please review the comment in the pull request or the pa11y-ci step in the workflow for details."
exit 1

0 comments on commit e7462c9

Please sign in to comment.