Skip to content

Commit 1f32351

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

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- name: Checkout Repo
15+
- name: Checkout Repository
1616
uses: actions/checkout@v4
1717
with:
1818
fetch-depth: 0
@@ -27,41 +27,39 @@ jobs:
2727
echo "$files" >> $GITHUB_OUTPUT
2828
echo "EOF" >> $GITHUB_OUTPUT
2929
30-
- name: Strip HTML Comments from Changed Markdown Files (PR only)
30+
- name: Prepare Sanitized Markdown Files (PR)
3131
if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
3232
run: |
33-
mkdir sanitized_md
33+
rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/
3434
for file in ${{ steps.changed-files.outputs.md_files }}; do
35-
mkdir -p "sanitized_md/$(dirname "$file")"
36-
sed '/<!--/,/-->/d' "$file" > "sanitized_md/$file"
35+
[ -f "sanitized_md/$file" ] && sed -i '/<!--/,/-->/d' "sanitized_md/$file"
3736
done
3837
39-
- name: Check Broken Links in Added/Modified Files (PR)
38+
- name: Run Lychee on Changed Markdown Files (PR)
4039
if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != ''
4140
uses: lycheeverse/[email protected]
4241
with:
4342
args: >
44-
--verbose --exclude-mail --no-progress --exclude ^https?://
45-
sanitized_md/**/*.md
43+
--verbose --no-progress --exclude-mail
44+
--exclude ^https?://
45+
sanitized_md/${{ steps.changed-files.outputs.md_files }}
4646
env:
4747
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4848

49-
- name: Strip HTML Comments from All Markdown Files (Manual)
49+
- name: Prepare Sanitized Markdown Files (Manual)
5050
if: github.event_name == 'workflow_dispatch'
5151
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
52+
rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/
53+
find sanitized_md -name "*.md" -exec sed -i '/<!--/,/-->/d' {} +
5754
58-
- name: Check Broken Links in Entire Repo (Manual)
55+
- name: Run Lychee on Entire Repo (Manual)
5956
if: github.event_name == 'workflow_dispatch'
6057
uses: lycheeverse/[email protected]
6158
with:
6259
args: >
63-
--verbose --exclude-mail --no-progress --exclude ^https?://
64-
sanitized_md/**/*.md
60+
--verbose --no-progress --exclude-mail
61+
--exclude ^https?://
62+
'sanitized_md/**/*.md'
6563
output: lychee/out.md
6664
env:
6765
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)