Update .gitea/actions/test-links/action.yml

This commit is contained in:
2025-11-23 15:38:12 +01:00
parent 9a97c2d0c2
commit 95bc69f844

View File

@@ -34,6 +34,9 @@ runs:
has_errors=0
file_index=1
# File to collect all broken links
> /tmp/broken_links_$$.txt
# Process each markdown file
while IFS= read -r md_file; do
echo "[$file_index/$total_files] Checking: $md_file"
@@ -120,6 +123,8 @@ runs:
status="✖ (HTTP $http_code)"
file_has_errors=1
has_errors=1
# Save broken link to persistent file
echo "$decoded_link" >> /tmp/broken_links_$$.txt
fi
# Categorize all links
@@ -235,13 +240,17 @@ runs:
if [ $has_errors -eq 0 ]; then
echo "[Link Checker Complete — all links valid in $total_files files]"
rm -f /tmp/broken_links_$$.txt
exit 0
else
echo "[Link Checker Complete — found broken links in $total_files files]"
echo ""
echo "Missing files:"
find /tmp -name "download_*.txt" -o -name "media_*.txt" -o -name "video_*.txt" -o -name "tags_*.txt" 2>/dev/null | while read -r temp_file; do
grep "✖" "$temp_file" 2>/dev/null || true
done | sed 's/.*✖ (HTTP [0-9]*) //' | sort -u
if [ -s /tmp/broken_links_$$.txt ]; then
sort -u /tmp/broken_links_$$.txt
else
echo "(no broken links file found)"
fi
rm -f /tmp/broken_links_$$.txt
exit 1
fi