@@ -19,10 +19,10 @@ jobs:
1919 - name : Setup Node.js
2020 uses : actions/setup-node@v4
2121 with :
22- node-version : ' 18 '
22+ node-version : ' 20 '
2323
2424 - name : Install markdown-link-check
25- run : npm install -g markdown-link-check
25+ run : npm install -g markdown-link-check@3.11.2
2626
2727 - name : Create markdown-link-check config
2828 run : |
6767 broken_links_found=0
6868
6969 while IFS= read -r -d '' file; do
70+ # Skip files that don't contain any internal links
71+ if ! grep -q "](\./" "$file" 2>/dev/null; then
72+ continue
73+ fi
7074 echo "Checking internal links in: $file"
7175
7276 # Check for broken relative links
@@ -101,25 +105,36 @@ jobs:
101105 run : |
102106 echo "Validating external links..."
103107 find docs -name "*.md" -type f | while read -r file; do
108+ # Skip files that don't contain any links
109+ if ! grep -q "](http" "$file" 2>/dev/null; then
110+ echo "ℹ️ Skipping $file (no external links found)"
111+ continue
112+ fi
104113 echo "Checking external links in: $file"
105- markdown-link-check "$file" --config .markdown-link-check.json || echo "Some external links failed in $file"
114+ # Use timeout to avoid hanging and make failures non-blocking
115+ timeout 30 markdown-link-check "$file" --config .markdown-link-check.json 2>/dev/null || \
116+ echo "⚠️ External link validation failed for $file (non-blocking)"
106117 done
118+ echo "✅ External link validation completed"
107119
108120 - name : Check for consistent link patterns
109121 run : |
110122 echo "Checking for inconsistent link patterns..."
111123 inconsistent_found=false
112124
113- # Check for bad patterns
114- if find docs -name "*.md" -exec grep -l "](docs/" {} \;; then
125+ # Check for internal docs/ prefix links (exclude external URLs)
126+ internal_docs_links=$(find docs -name "*.md" -type f -exec grep -H "](docs/" {} \; 2>/dev/null | grep -v "https\?://[^)]*docs/" || true)
127+ if [[ -n "$internal_docs_links" ]]; then
115128 echo "❌ Found links using 'docs/' prefix - use relative paths instead"
116- find docs -name "*.md" -exec grep -Hn "](docs/" {} \;
129+ echo "$internal_docs_links"
117130 inconsistent_found=true
118131 fi
119132
120- if find docs -name "*.md" -exec grep -l "](\.\./" {} \;; then
133+ # Check for ../ patterns
134+ dotdot_links=$(find docs -name "*.md" -type f -exec grep -Hn "](\.\./" {} \; 2>/dev/null || true)
135+ if [[ -n "$dotdot_links" ]]; then
121136 echo "❌ Found links using '../' - use relative paths from docs root instead"
122- find docs -name "*.md" -exec grep -Hn "](\.\./" {} \;
137+ echo "$dotdot_links"
123138 inconsistent_found=true
124139 fi
125140
0 commit comments