diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c8fbe49..dc39c96 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -10,6 +10,10 @@ on: - "CONTRIBUTING.md" - "CODE_OF_CONDUCT.md" +permissions: + pull-requests: write + contents: read + jobs: compile-themes: runs-on: ubuntu-latest @@ -38,3 +42,40 @@ jobs: sass src/themes/chimera-nightsky.scss build/chimera-nightsky.css shell: bash working-directory: ./chimera-css + + accessibility-testing: + runs-on: ubuntu-latest + name: Running pa11y-ci tests on HTML file + + steps: + - name: Checkout source + uses: actions/checkout@v2 + + - name: Install pa11y-ci dependencies + run: npm install -g pa11y-ci + + - name: Run pa11y-ci on static HTML file + run: pa11y-ci file://$GITHUB_WORKSPACE/apps/demo/index.html 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@v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + message: '
Pa11y testing results + + +```${{ steps.pa11y_output.outputs.content }}``` + +
' + + - 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 \ No newline at end of file diff --git a/pa11yci.json b/pa11yci.json new file mode 100644 index 0000000..4168b5b --- /dev/null +++ b/pa11yci.json @@ -0,0 +1,9 @@ +{ + "defaults": { + "standard": "WCAG2AA", + "timeout": 30000 + }, + "urls": [ + "http://localhost:8080/index.html" + ] +} \ No newline at end of file