Skip to content

Test img

Test img #1

name: Accessibility
on:
pull_request:
branches: [main]
types: [opened, synchronize]
env:
BUILD_DIR: 'client/www/next-build'
jobs:
accessibility:
name: Runs axe accessibility testing on changed pages
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 https://github.com/actions/checkout/commit/9bb56186c3b09b4f86b1c65136769dd318469633
- name: Setup Node.js 20
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # 4.0.2 https://github.com/actions/setup-node/releases/tag/v4.0.2
with:
node-version: 20.x
- name: Install dependencies
run: yarn
- name: Build
run: yarn build
env:
NODE_OPTIONS: --max_old_space_size=4096
- name: Get changed/new pages to run accessibility tests on
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script/commit/60a0d83039c74a4aee543508d2ffcb1c3799cdea
id: pages-to-a11y-test
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { getChangedPages } = require('./.github/workflows/scripts/check_for_changed_pages.js');
return getChangedPages({github, context}, env.BUILD_DIR);
- name: Run site
run: |
python -m http.server 3000 -d ${{ env.BUILD_DIR }} &
sleep 5
- name: Run accessibility tests on changed/new MDX pages
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 https://github.com/actions/github-script/commit/60a0d83039c74a4aee543508d2ffcb1c3799cdea
id: axeResults
with:
result-encoding: string
script: |
const { runAxe } = require('./.github/workflows/scripts/run_axe.js');
const pages = ${{ steps.pages-to-a11y-test.outputs.result }}
return await runAxe(pages)