Skip to content

Commit d054277

Browse files
Copilottuanductran
andcommitted
Add link-checker workflow with lychee-action
Co-authored-by: tuanductran <69758022+tuanductran@users.noreply.github.com>
1 parent 051c887 commit d054277

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/link-checker.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Link Checker
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
link-checker:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v6
17+
18+
- name: Link Checker
19+
uses: lycheeverse/lychee-action@v2
20+
with:
21+
# Scan all markdown files in the repository
22+
args: >-
23+
--verbose
24+
--no-progress
25+
--exclude-path './node_modules'
26+
--exclude-path './pnpm-lock.yaml'
27+
--exclude '^file://'
28+
--exclude '^mailto:'
29+
--scheme https
30+
--accept 200,201,202,203,204,206,300,301,302,303,307,308,429
31+
--timeout 30
32+
--max-retries 3
33+
--retry-wait-time 5
34+
'skills/**/*.md'
35+
'templates/**/*.md'
36+
'README.md'
37+
'CLAUDE.md'
38+
# Fail the build if broken links are found
39+
fail: true
40+
env:
41+
# Use GitHub token to avoid rate limiting
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Output link checker results
45+
if: always()
46+
run: |
47+
echo "📊 Link checker results are available in the workflow logs above."
48+
echo ""
49+
echo "To view detailed results:"
50+
echo "1. Go to the 'Actions' tab in the GitHub repository"
51+
echo "2. Select this workflow run"
52+
echo "3. Click on the 'link-checker' job"
53+
echo "4. Expand the 'Link Checker' step to see detailed results"
54+
echo ""
55+
echo "ℹ️ The workflow will fail if any broken links (404s, timeouts, etc.) are detected."
56+
echo "ℹ️ Only external HTTPS links are checked. Local file paths and mailto links are excluded."

0 commit comments

Comments
 (0)