Skip to content

Commit 7824fc2

Browse files
Update Broken-links-checker-final.yml
1 parent e7401dc commit 7824fc2

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

.github/workflows/Broken-links-checker-final.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,41 @@ jobs:
2727
echo "$files" >> $GITHUB_OUTPUT
2828
echo "EOF" >> $GITHUB_OUTPUT
2929
30+
- name: Strip HTML Comments from Changed Markdown Files (PR only)
31+
if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
32+
run: |
33+
mkdir sanitized_md
34+
for file in ${{ steps.changed-files.outputs.md_files }}; do
35+
mkdir -p "sanitized_md/$(dirname "$file")"
36+
sed '/<!--/,/-->/d' "$file" > "sanitized_md/$file"
37+
done
38+
3039
- name: Check Broken Links in Added/Modified Files (PR)
3140
if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
3241
uses: lycheeverse/[email protected]
3342
with:
3443
args: >
3544
--verbose --exclude-mail --no-progress --exclude ^https?://
36-
--include-comments false
37-
${{ steps.changed-files.outputs.md_files }}
45+
sanitized_md/**/*.md
3846
env:
3947
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4048

49+
- name: Strip HTML Comments from All Markdown Files (Manual)
50+
if: github.event_name == 'workflow_dispatch'
51+
run: |
52+
mkdir sanitized_md
53+
for file in $(find . -name "*.md"); do
54+
mkdir -p "sanitized_md/$(dirname "$file")"
55+
sed '/<!--/,/-->/d' "$file" > "sanitized_md/$file"
56+
done
57+
4158
- name: Check Broken Links in Entire Repo (Manual)
4259
if: github.event_name == 'workflow_dispatch'
4360
uses: lycheeverse/[email protected]
4461
with:
4562
args: >
4663
--verbose --exclude-mail --no-progress --exclude ^https?://
47-
--include-comments false
48-
'**/*.md'
64+
sanitized_md/**/*.md
4965
output: lychee/out.md
5066
env:
5167
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)