name: Check broken links in docs
on:
pull_request:
branches:
- master
jobs:
check-broken-links-in-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Restore lychee cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-
- name: Check links in docs/*.md
uses: lycheeverse/lychee-action@v2
with:
fail: true
token: ${{ secrets.GITHUB_TOKEN }}
args:
--accept '200..=204,429,500'
--verbose --verbose
--no-progress
--cache
--max-cache-age 1d
--exclude 'https://dl.acm.org/**'
'./docs/**/*.md'
- name: On link check failure
if: failure()
run: |
echo "Link check failed. Please read the summary in the last step."
if grep -q 403 lychee/out.md; then
echo "Some links received reply code 403 Forbidden:"
grep 403 lychee/out.md
echo "If the server disallows robot access,"
echo "please exclude affected web sites in .github/workflows/link-check.yml"
fi
- name: Save lychee cache
uses: actions/cache/save@v4
if: always()
with:
path: .lycheecache
key: ${{ steps.restore-cache.outputs.cache-primary-key }}