| name: Check documentation links | |
| # check the links of the documentation weekly; external links break without any change in this repository | |
| on: | |
| schedule: | |
| - cron: '17 4 * * 1' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| check_docs_links: | |
| if: github.repository == 'nlohmann/json' | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@ccd8616d44fd3846e67624a50d5aad6d37bf2d25 # v2.22.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| - name: Install virtual environment | |
| run: make install_venv -C docs/mkdocs | |
| - name: Check links | |
| shell: bash # adds -o pipefail, so tee does not hide the exit code | |
| run: make link_check -C docs/mkdocs 2>&1 | tee link_check.log | |
| - name: Summarize broken links | |
| if: failure() | |
| run: | | |
| { | |
| echo '### Broken documentation links' | |
| echo '```' | |
| grep 'invalid url' link_check.log || true | |
| echo '```' | |
| } >> "$GITHUB_STEP_SUMMARY" |