Update .gitea/actions/test-links/action.yml
This commit is contained in:
@@ -34,6 +34,9 @@ runs:
|
|||||||
has_errors=0
|
has_errors=0
|
||||||
file_index=1
|
file_index=1
|
||||||
|
|
||||||
|
# File to collect all broken links
|
||||||
|
> /tmp/broken_links_$$.txt
|
||||||
|
|
||||||
# Process each markdown file
|
# Process each markdown file
|
||||||
while IFS= read -r md_file; do
|
while IFS= read -r md_file; do
|
||||||
echo "[$file_index/$total_files] Checking: $md_file"
|
echo "[$file_index/$total_files] Checking: $md_file"
|
||||||
@@ -120,6 +123,8 @@ runs:
|
|||||||
status="✖ (HTTP $http_code)"
|
status="✖ (HTTP $http_code)"
|
||||||
file_has_errors=1
|
file_has_errors=1
|
||||||
has_errors=1
|
has_errors=1
|
||||||
|
# Save broken link to persistent file
|
||||||
|
echo "$decoded_link" >> /tmp/broken_links_$$.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Categorize all links
|
# Categorize all links
|
||||||
@@ -235,13 +240,17 @@ runs:
|
|||||||
|
|
||||||
if [ $has_errors -eq 0 ]; then
|
if [ $has_errors -eq 0 ]; then
|
||||||
echo "[Link Checker Complete — all links valid in $total_files files]"
|
echo "[Link Checker Complete — all links valid in $total_files files]"
|
||||||
|
rm -f /tmp/broken_links_$$.txt
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "[Link Checker Complete — found broken links in $total_files files]"
|
echo "[Link Checker Complete — found broken links in $total_files files]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Missing files:"
|
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
|
if [ -s /tmp/broken_links_$$.txt ]; then
|
||||||
grep "✖" "$temp_file" 2>/dev/null || true
|
sort -u /tmp/broken_links_$$.txt
|
||||||
done | sed 's/.*✖ (HTTP [0-9]*) //' | sort -u
|
else
|
||||||
|
echo "(no broken links file found)"
|
||||||
|
fi
|
||||||
|
rm -f /tmp/broken_links_$$.txt
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user