|
| 1 | +# Copyright (c) 2022-2025, The Isaac Lab Project Developers (https://github.com/isaac-sim/IsaacLab/blob/main/CONTRIBUTORS.md). |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: BSD-3-Clause |
| 5 | + |
| 6 | +name: Check Documentation Links |
| 7 | + |
| 8 | +on: |
| 9 | + # Run on pull requests that modify documentation |
| 10 | + pull_request: |
| 11 | + paths: |
| 12 | + - 'docs/**' |
| 13 | + - '**.md' |
| 14 | + - '.github/workflows/check-links.yml' |
| 15 | + # Run on pushes to main branches |
| 16 | + push: |
| 17 | + branches: |
| 18 | + - main |
| 19 | + - devel |
| 20 | + - 'release/**' |
| 21 | + paths: |
| 22 | + - 'docs/**' |
| 23 | + - '**.md' |
| 24 | + - '.github/workflows/check-links.yml' |
| 25 | + # Allow manual trigger |
| 26 | + workflow_dispatch: |
| 27 | + # Run weekly to catch external links that break over time |
| 28 | + schedule: |
| 29 | + - cron: '0 0 * * 0' # Every Sunday at midnight UTC |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + check-links: |
| 37 | + name: Check for Broken Links |
| 38 | + runs-on: ubuntu-latest |
| 39 | + |
| 40 | + steps: |
| 41 | + - name: Checkout code |
| 42 | + uses: actions/checkout@v4 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + |
| 46 | + - name: Restore lychee cache |
| 47 | + uses: actions/cache@v4 |
| 48 | + with: |
| 49 | + path: .lycheecache |
| 50 | + key: cache-lychee-${{ github.sha }} |
| 51 | + restore-keys: cache-lychee- |
| 52 | + |
| 53 | + - name: Run Link Checker |
| 54 | + uses: lycheeverse/lychee-action@v2 |
| 55 | + with: |
| 56 | + # Check all markdown files and documentation |
| 57 | + args: >- |
| 58 | + --verbose |
| 59 | + --no-progress |
| 60 | + --cache |
| 61 | + --max-cache-age 1d |
| 62 | + --exclude-path './docs/_build' |
| 63 | + --exclude-path './apps/warp-*' |
| 64 | + --exclude-path './logs' |
| 65 | + --exclude-path './outputs' |
| 66 | + --exclude-loopback |
| 67 | + --exclude '^file://' |
| 68 | + --exclude '^mailto:' |
| 69 | + --exclude 'localhost' |
| 70 | + --exclude '127\.0\.0\.1' |
| 71 | + --exclude 'example\.com' |
| 72 | + --exclude 'your-organization' |
| 73 | + --exclude 'YOUR_' |
| 74 | + --exclude 'yourdomain' |
| 75 | + --exclude 'user@' |
| 76 | + --exclude 'helm\.ngc\.nvidia\.com' |
| 77 | + --exclude 'slurm\.schedmd\.com' |
| 78 | + --max-retries 3 |
| 79 | + --retry-wait-time 5 |
| 80 | + --timeout 30 |
| 81 | + --accept 200,201,202,203,204,206,301,302,303,307,308,429 |
| 82 | + --scheme https |
| 83 | + --scheme http |
| 84 | + '*.md' |
| 85 | + '**/*.md' |
| 86 | + 'docs/**/*.rst' |
| 87 | + 'docs/**/*.html' |
| 88 | + # Output results to a file |
| 89 | + output: ./lychee-output.md |
| 90 | + # Fail action on broken links |
| 91 | + fail: true |
| 92 | + # Optional: Use GitHub token for authenticated requests (higher rate limit) |
| 93 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 94 | + |
| 95 | + - name: Print results to logs |
| 96 | + if: always() |
| 97 | + run: | |
| 98 | + echo "========================================" |
| 99 | + echo "Link Checker Results:" |
| 100 | + echo "========================================" |
| 101 | + if [ -f ./lychee-output.md ]; then |
| 102 | + cat ./lychee-output.md |
| 103 | + echo "" |
| 104 | + echo "========================================" |
| 105 | +
|
| 106 | + # Also add to GitHub step summary for easy viewing |
| 107 | + echo "## Link Checker Results" >> $GITHUB_STEP_SUMMARY |
| 108 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 109 | + cat ./lychee-output.md >> $GITHUB_STEP_SUMMARY |
| 110 | + else |
| 111 | + echo "No output file generated" |
| 112 | + echo "========================================" |
| 113 | + fi |
| 114 | +
|
| 115 | + - name: Fail job if broken links found |
| 116 | + if: failure() |
| 117 | + run: | |
| 118 | + echo "❌ Broken links were found in the documentation!" |
| 119 | + echo "Please review the link checker report above and fix all broken links." |
| 120 | + exit 1 |
0 commit comments