@@ -20,34 +20,38 @@ jobs:
2020 with :
2121 fetch-depth : 0
2222
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
2526 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'
3437 uses :
lycheeverse/[email protected] 3538 with :
3639 args : >
3740 --verbose --exclude-mail --no-progress --exclude ^https?://
38- ${{ steps.changed-files.outputs.md_files }}
41+ ${{ steps.changed-markdown- files.outputs.all_changed_files }}
3942 failIfEmpty : false
4043 env :
4144 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
4245
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
4449 if : github.event_name == 'workflow_dispatch'
4550 uses :
lycheeverse/[email protected] 4651 with :
4752 args : >
4853 --verbose --exclude-mail --no-progress --exclude ^https?://
4954 '**/*.md'
5055 failIfEmpty : false
51- output : lychee/out.md
5256 env :
5357 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments