diff --git a/.github/workflows/broken-link-check.yml b/.github/workflows/broken-link-check.yml new file mode 100644 index 0000000..12106d6 --- /dev/null +++ b/.github/workflows/broken-link-check.yml @@ -0,0 +1,62 @@ +--- +# 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.7.0 + uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 + 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' + # v6.0.0 + # yamllint disable-line rule:line-length + uses: peter-evans/create-issue-from-file@fca9117c27cdc29c6c4db3b86c48e4115a786710 + with: + title: Broken Links Detected + content-filepath: ./lychee/out.md + labels: | + bug + documentation