|
1 | 1 | --- |
| 2 | +# Note: The original broken-link-checker-action |
| 3 | +# (technote-space/broken-link-checker-action) was archived in Nov 2022 |
| 4 | +# and is no longer maintained. This workflow uses lychee-action, |
| 5 | +# a well-maintained alternative that provides similar functionality |
| 6 | +# with better performance. If you specifically need the original action, |
| 7 | +# you can switch back to: uses: technote-space/broken-link-checker-action@v2 |
| 8 | + |
2 | 9 | name: Broken Link Check |
3 | 10 |
|
4 | 11 | "on": |
5 | 12 | schedule: |
6 | 13 | # Run monthly on the 1st at midnight UTC |
7 | 14 | - cron: '0 0 1 * *' |
8 | 15 | workflow_dispatch: # Allow manual triggering |
9 | | - repository_dispatch: |
10 | | - types: [check-link] |
| 16 | + pull_request: |
| 17 | + branches: [main, develop] |
11 | 18 |
|
12 | 19 | jobs: |
13 | 20 | check: |
14 | 21 | name: Check Broken Links |
15 | 22 | runs-on: ubuntu-latest |
16 | 23 |
|
17 | 24 | steps: |
18 | | - - name: Broken Link Check |
19 | | - uses: technote-space/broken-link-checker-action@v2 |
| 25 | + - name: Checkout code |
| 26 | + uses: actions/checkout@v4 |
| 27 | + |
| 28 | + - name: Check links with lychee |
| 29 | + uses: lycheeverse/lychee-action@v2 |
20 | 30 | with: |
21 | | - TARGET: 'https://github.com/${{ github.repository }}' |
22 | | - RECURSIVE: 'true' |
23 | | - LABELS: 'bug,documentation' |
24 | | - TITLE: 'Broken link found: ${URL}' |
| 31 | + # Check all markdown files in repository |
| 32 | + args: --verbose --no-progress './**/*.md' |
| 33 | + # Fail action on broken links |
| 34 | + fail: true |
| 35 | + env: |
25 | 36 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 37 | + |
| 38 | + - name: Create Issue From File |
| 39 | + if: failure() |
| 40 | + uses: peter-evans/create-issue-from-file@v5 |
| 41 | + with: |
| 42 | + title: Broken Links Detected |
| 43 | + content-filepath: ./lychee/out.md |
| 44 | + labels: | |
| 45 | + bug |
| 46 | + documentation |
0 commit comments