@@ -20,34 +20,38 @@ jobs:
20
20
with :
21
21
fetch-depth : 0
22
22
23
- - name : Get Added/Modified Markdown Files (PR only)
24
- id : changed-files
23
+ # For PR : Get only changed markdown files
24
+ - name : Get changed markdown files (PR only)
25
+ id : changed-markdown-files
25
26
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 != ''
27
+ uses : tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46
28
+ with :
29
+ files : |
30
+ **/*.md
31
+
32
+
33
+ # For PR: Check broken links only in changed files
34
+ - name : Check Broken Links in Changed Markdown Files
35
+ id : lychee-check-pr
36
+ if : github.event_name == 'pull_request' && steps.changed-markdown-files.outputs.any_changed == 'true'
34
37
uses :
lycheeverse/[email protected]
35
38
with :
36
39
args : >
37
40
--verbose --exclude-mail --no-progress --exclude ^https?://
38
- ${{ steps.changed-files.outputs.md_files }}
41
+ ${{ steps.changed-markdown- files.outputs.all_changed_files }}
39
42
failIfEmpty : false
40
43
env :
41
44
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
42
45
43
- - name : Check Broken Links in Entire Repo (Manual)
46
+ # For manual trigger: Check all markdown files in repo
47
+ - name : Check Broken Links in All Markdown Files in Entire Repo (Manual Trigger)
48
+ id : lychee-check-manual
44
49
if : github.event_name == 'workflow_dispatch'
45
50
uses :
lycheeverse/[email protected]
46
51
with :
47
52
args : >
48
53
--verbose --exclude-mail --no-progress --exclude ^https?://
49
54
'**/*.md'
50
55
failIfEmpty : false
51
- output : lychee/out.md
52
56
env :
53
57
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments