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