|
44 | 44 | - name: Check internal links |
45 | 45 | uses: lycheeverse/lychee-action@8646ba30535128ac92d33dfc9133794bfdd9b411 # v2 |
46 | 46 | with: |
47 | | - args: --offline --no-progress --root-dir docs/public './docs/public/**/*.html' |
| 47 | + # --remap makes lychee resolve absolute docs.defectdojo.com URLs against |
| 48 | + # the freshly built site, so absURL-rendered links (e.g. nav menu items) |
| 49 | + # are verified as 404s instead of being skipped as remote URLs. |
| 50 | + args: >- |
| 51 | + --offline --no-progress |
| 52 | + --root-dir ${{ github.workspace }}/docs/public |
| 53 | + --remap "https://docs.defectdojo.com file://${{ github.workspace }}/docs/public" |
| 54 | + './docs/public/**/*.html' |
48 | 55 | fail: true |
49 | 56 |
|
| 57 | + - name: Check in-app docs help links |
| 58 | + # Find every file under dojo/ that hardcodes a docs.defectdojo.com URL |
| 59 | + # (templates, settings, etc.) and check those links against the freshly |
| 60 | + # built site. --remap turns the absolute docs URLs into local file lookups; |
| 61 | + # --exclude '%7[BD]' drops URL-encoded Django template tags ({% ... %}) |
| 62 | + # so only real external docs URLs are checked. lychee is on $PATH from |
| 63 | + # the previous lychee-action step. |
| 64 | + run: | |
| 65 | + set -euo pipefail |
| 66 | + mapfile -t files < <(grep -rl 'docs\.defectdojo\.com' dojo/ \ |
| 67 | + --include='*.html' --include='*.py' --include='*.tpl') |
| 68 | + if [ "${#files[@]}" -eq 0 ]; then |
| 69 | + echo "No files reference docs.defectdojo.com — pattern is stale." >&2 |
| 70 | + exit 1 |
| 71 | + fi |
| 72 | + printf 'Checking in-app docs links in:\n' |
| 73 | + printf ' %s\n' "${files[@]}" |
| 74 | + lychee --offline --no-progress \ |
| 75 | + --root-dir "${GITHUB_WORKSPACE}/docs/public" \ |
| 76 | + --remap "https://docs.defectdojo.com file://${GITHUB_WORKSPACE}/docs/public" \ |
| 77 | + --exclude '%7[BD]' \ |
| 78 | + "${files[@]}" |
| 79 | +
|
0 commit comments