This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 122
55 lines (42 loc) · 1.83 KB
/
pa11y.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Pulled from Daniel Mundra's blog post https://accessibility.civicactions.com/posts/automated-accessibility-testing-leveraging-github-actions-and-pa11y-ci-with-axe
name: pa11y tests
on: [pull_request]
jobs:
build:
name: Building site and running pa11y-ci tests
runs-on: ubuntu-latest
steps:
- name: Checkout source.
uses: actions/checkout@v2
- name: Install jekyll site dependencies.
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.2
bundler-cache: true
- name: Install pa11y-ci dependencies.
run: npm install
- name: Start up jekyll server.
run: npm run start-detached
- 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@main
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: '<details><summary>Pa11y testing results</summary>
```${{ steps.pa11y_output.outputs.content }}```
</details>'
# A defect in pa11y is causing intermitent page crashes [1]. Until it is
# fixed, if a page crashes during a scan, do not mark the pa11y scan as
# failed.
# [1] https://github.com/pa11y/pa11y-ci/issues/128
- name: Check for pa11y failures.
if: "${{ contains(steps.pa11y_output.outputs.content, 'errno 2') && !contains(steps.pa11y_output.outputs.content, 'UnhandledPromiseRejectionWarning: Error: Page crashed!') }}"
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