a11y check on canonical.com #49
This file contains hidden or 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: a11y check on canonical.com | |
| on: | |
| schedule: | |
| - cron: "20 7 * * 1" # every Monday at 07:20 UTC | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| read-config: | |
| if: github.repository == 'canonical/canonical.com' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| urls: ${{ steps.get-urls.outputs.urls }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Read links from test-links.yaml | |
| id: get-urls | |
| run: | | |
| urls=$(yq e '.links[].url' test-links.yaml | tr '\n' ' ' | sed 's/ *$//') | |
| echo "urls=$urls" >> $GITHUB_OUTPUT | |
| check-a11y: | |
| if: github.repository == 'canonical/canonical.com' | |
| runs-on: ubuntu-latest | |
| needs: read-config | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: "yarn" | |
| - name: Install dependencies | |
| run: yarn --frozen-lockfile | |
| - name: Run a11y tests | |
| env: | |
| URL_LIST: ${{ needs.read-config.outputs.urls }} | |
| PUPPETEER_EXECUTABLE_PATH: /usr/bin/google-chrome | |
| run: | | |
| yarn pa11y-ci $URL_LIST | |
| - name: Send message on failure | |
| env: | |
| BOT_URL: ${{ secrets.BOT_URL }} | |
| if: failure() | |
| run: curl -X POST -F "workflow=${GITHUB_WORKFLOW}" -F "repo_name=${GITHUB_REPOSITORY}" -F "action_id=${GITHUB_RUN_ID}" $BOT_URL?room=web-alerts |