GitHub Action: runs Axe accessibility tests on changed files #2
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
name: pa11y-ci | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- gh-pages | |
pull_request: | |
permissions: | |
contents: read | |
pull-requests: read | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
calculate-pages-changed: | |
name: Calculate URLs of pages changed from gh-pages branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Calculate URLs and output to JavaScript module | |
run: sh ./generate_pa11y_ci_urls_from_git_diff.sh gh-pages | |
- name: Log contents of resulting JavaScript module | |
run: cat ./pa11y-ci-urls.js | |
run-blog: | |
name: Run the blog locally | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.3 | |
- name: Install gems | |
run: bundle config path vendor/bundle && bundle install | |
- name: Run the blog | |
run: bundle exec jekyll serve & | |
run-pa11y-ci: | |
name: Run pa11y-ci against the local version of the blog | |
runs-on: ubuntu-latest | |
needs: | |
- calculate-pages-changed | |
- run-blog | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.10.x | |
cache: npm | |
- name: Install NPM dependencies | |
run: npm ci | |
- name: Run pa11y-ci | |
run: npm run pa11y-ci |