Add automated broken link checker workflow #2
Workflow file for this run
This file contains hidden or 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
| --- | |
| # Note: The original broken-link-checker-action | |
| # (technote-space/broken-link-checker-action) was archived in Nov 2022 | |
| # and is no longer maintained. This workflow uses lychee-action, | |
| # a well-maintained alternative that provides similar functionality | |
| # with better performance. If you specifically need the original action, | |
| # you can switch back to: uses: technote-space/broken-link-checker-action@v2 | |
| name: Broken Link Check | |
| "on": | |
| schedule: | |
| # Run monthly on the 1st at midnight UTC | |
| - cron: '0 0 1 * *' | |
| workflow_dispatch: # Allow manual triggering | |
| pull_request: | |
| branches: [main, develop] | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| check: | |
| name: Check Broken Links | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check links with lychee | |
| # Pin to specific commit SHA for security and reproducibility | |
| # v2.1.0 | |
| uses: lycheeverse/lychee-action@2b973e86fc5d6f3e1e3b8ad7123e5e09c19fcab7 | |
| with: | |
| # Check all markdown files in repository | |
| args: >- | |
| --verbose | |
| --no-progress | |
| --max-retries 3 | |
| --timeout 30 | |
| './**/*.md' | |
| # Output results to file for issue creation | |
| output: ./lychee/out.md | |
| # Fail action on broken links | |
| fail: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create Issue From File | |
| # Only create issues on scheduled runs or manual triggers | |
| if: failure() && github.event_name != 'pull_request' | |
| uses: peter-evans/create-issue-from-file@v5 | |
| with: | |
| title: Broken Links Detected | |
| content-filepath: ./lychee/out.md | |
| labels: | | |
| bug | |
| documentation |