File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Broken Link Checker
2+
3+ on :
4+ pull_request :
5+ paths :
6+ - ' **/*.md'
7+ workflow_dispatch :
8+
9+ jobs :
10+ markdown-link-check :
11+ name : Check Markdown Broken Links
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout Repo
16+ uses : actions/checkout@v4
17+ with :
18+ fetch-depth : 0
19+
20+ - name : Get Added/Modified Markdown Files (PR only)
21+ id : changed-files
22+ if : github.event_name == 'pull_request'
23+ run : |
24+ git fetch origin ${{ github.base_ref }}
25+ files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true)
26+ echo "md_files<<EOF" >> $GITHUB_OUTPUT
27+ echo "$files" >> $GITHUB_OUTPUT
28+ echo "EOF" >> $GITHUB_OUTPUT
29+
30+ - name : Check Broken Links in Added/Modified Files (PR)
31+ if : github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
32+ uses : lycheeverse/lychee-action@v2.4.1
33+ with :
34+ args : >
35+ --verbose --exclude-mail --no-progress --exclude ^https?://
36+ ${{ steps.changed-files.outputs.md_files }}
37+ env :
38+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
39+
40+ - name : Check Broken Links in Entire Repo (Manual)
41+ if : github.event_name == 'workflow_dispatch'
42+ uses : lycheeverse/lychee-action@v2.4.1
43+ with :
44+ args : >
45+ --verbose --exclude-mail --no-progress --exclude ^https?://
46+ '**/*.md'
47+ output : lychee/out.md
48+ env :
49+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments