Anchor link audit #4
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: Anchor link audit | |
# **What it does**: Regularly audits our documentation for broken internal anchor links. | |
# **Why we have it**: B/c checking on the individual commit push level is too granular, but we want to address broken headers periodically. | |
# **Who does it impact**: PCX team | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # Run at 00:00 UTC every Sunday | |
workflow_dispatch: | |
jobs: | |
compile: | |
name: Compiles | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.1 | |
- uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.110.0' | |
extended: true | |
- name: (env) pnpm | |
run: curl -L https://raw.githubusercontent.com/pnpm/self-installer/master/install.js | node | |
- run: pnpm install | |
- run: make build | |
env: | |
NODE_OPTIONS: "--max-old-space-size=8192" | |
- name: Install dependencies | |
run: curl https://htmltest.wjdp.uk | bash | |
- name: Check - Broken header links | |
id: header-link-check | |
run: ./bin/htmltest -c ./bin/.htmltest.yml | |
- name: Create issue on failure | |
if: ${{ failure() }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WORKFLOW_LINK: ${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }} | |
run: | | |
echo "Specific header links in the [Workflow Run]($WORKFLOW_LINK).\n\nGenerally, we expect you to address at least 10-15 links before closing this out." > issue_body.txt | |
curl --silent -X POST -H "Authorization: Bearer $GITHUB_TOKEN" \ | |
-H "Accept: application/vnd.github+json" \ | |
"https://api.github.com/repos/$GITHUB_REPOSITORY/issues" \ | |
-d "{\"title\": \"Broken Header Links Found\", \"body\": \"$(cat issue_body.txt)\", \"assignees\": [\"kodster28\", \"haleycode\"]}" |