Update .gitea/workflows/test-skins.yml

This commit is contained in:
2025-11-23 14:50:29 +01:00
parent cc74cf032e
commit 8a1fb0ed6c

View File

@@ -16,25 +16,21 @@ jobs:
#!/bin/bash
set -o pipefail
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "🔍 Checking ALL Links in All Markdown Files"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "[Link Checker Job Started]"
echo ""
# Find all markdown files
find . -name "*.md" -type f | sort > all_markdown_files.txt
total_files=$(wc -l < all_markdown_files.txt)
echo "📊 Found $total_files markdown files to check"
echo "Found $total_files markdown files to check"
echo ""
has_errors=0
file_index=1
# Process each markdown file
while IFS= read -r md_file; do
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "📄 Checking: $md_file"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "[$file_index/$total_files] Checking: $md_file"
file_has_errors=0
@@ -51,13 +47,13 @@ jobs:
link_count=$(wc -l < /tmp/links_$$.txt 2>/dev/null || echo "0")
if [ $link_count -eq 0 ]; then
echo " No links found in this file"
echo " No links found"
echo ""
file_index=$((file_index + 1))
continue
fi
echo " 📊 Found $link_count links to check"
echo ""
echo " → Checking $link_count links..."
# Categorize and check links
> /tmp/download_$$.txt
@@ -91,22 +87,22 @@ jobs:
# Accept 2xx and 3xx status codes as valid
if ! [[ "$http_code" =~ ^[23][0-9][0-9]$ ]]; then
status=" (HTTP $http_code)"
status=" (HTTP $http_code)"
file_has_errors=1
has_errors=1
fi
# Categorize external URLs
if [[ "$decoded_link" =~ /export/.*\.(osk|osz)$ ]]; then
echo " $status $decoded_link" >> /tmp/download_$$.txt
echo " $status $decoded_link" >> /tmp/download_$$.txt
elif [[ "$decoded_link" =~ /media/gameplay/.*\.(mp4|webm)$ ]]; then
echo " $status $decoded_link" >> /tmp/video_$$.txt
echo " $status $decoded_link" >> /tmp/video_$$.txt
elif [[ "$decoded_link" =~ /src/tag/ ]]; then
echo " $status $decoded_link" >> /tmp/tags_$$.txt
echo " $status $decoded_link" >> /tmp/tags_$$.txt
elif [[ "$decoded_link" =~ /media/(panel|icons|thumbnail)/ ]]; then
echo " $status $decoded_link" >> /tmp/media_$$.txt
echo " $status $decoded_link" >> /tmp/media_$$.txt
else
echo " $status $decoded_link" >> /tmp/download_$$.txt
echo " $status $decoded_link" >> /tmp/download_$$.txt
fi
else
# Local file - remove leading slash if present
@@ -119,18 +115,18 @@ jobs:
# Check if file exists
if ! [ -f "$file_path" ]; then
status=" (not found)"
status=" (not found)"
file_has_errors=1
has_errors=1
fi
# Categorize local files
if [[ "$decoded_link" =~ \.(webp|png|jpg|jpeg)$ ]]; then
echo " $status $decoded_link" >> /tmp/media_$$.txt
echo " $status $decoded_link" >> /tmp/media_$$.txt
elif [[ "$decoded_link" =~ \.md$ ]]; then
echo " $status $decoded_link" >> /tmp/tags_$$.txt
echo " $status $decoded_link" >> /tmp/tags_$$.txt
else
echo " $status $decoded_link" >> /tmp/download_$$.txt
echo " $status $decoded_link" >> /tmp/download_$$.txt
fi
fi
done < /tmp/links_$$.txt
@@ -149,7 +145,7 @@ jobs:
if [ -s /tmp/download_$$.txt ]; then
general_downloads=$(grep -v '/export/.*\.osk' /tmp/download_$$.txt | sort -u || true)
if [ -n "$general_downloads" ]; then
echo "general:"
echo " general:"
echo "$general_downloads"
echo ""
fi
@@ -159,7 +155,7 @@ jobs:
while IFS= read -r skin_name; do
[ -z "$skin_name" ] && continue
echo "skin: $skin_name"
echo " skin: $skin_name"
# Download link
grep "/export/$skin_name/.*\.osk" /tmp/download_$$.txt 2>/dev/null | sort -u || true
@@ -177,7 +173,7 @@ jobs:
if [ -s /tmp/tags_$$.txt ]; then
version_tags=$(grep '/src/tag/' /tmp/tags_$$.txt | sort -u || true)
if [ -n "$version_tags" ]; then
echo "version tags:"
echo " version tags:"
echo "$version_tags"
echo ""
fi
@@ -187,25 +183,25 @@ jobs:
else
# For other markdown files, show categorized as before
if [ -s /tmp/download_$$.txt ]; then
echo "download:"
echo " download:"
sort -u /tmp/download_$$.txt
echo ""
fi
if [ -s /tmp/media_$$.txt ]; then
echo "media:"
echo " media:"
sort -u /tmp/media_$$.txt
echo ""
fi
if [ -s /tmp/video_$$.txt ]; then
echo "video:"
echo " video:"
sort -u /tmp/video_$$.txt
echo ""
fi
if [ -s /tmp/tags_$$.txt ]; then
echo "tags:"
echo " tags:"
sort -u /tmp/tags_$$.txt
echo ""
fi
@@ -216,24 +212,21 @@ jobs:
rm -f /tmp/links_$$.txt
if [ $file_has_errors -eq 0 ]; then
echo ""
echo " ✅ All links valid in this file"
echo " ✓ All links valid"
else
echo ""
echo " ❌ Some links are broken in this file"
echo " ✖ Some links broken"
fi
echo ""
file_index=$((file_index + 1))
done < all_markdown_files.txt
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
if [ $has_errors -eq 0 ]; then
echo "✅ FINAL RESULT: All links are valid across all markdown files!"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "[Link Checker Complete — all links valid in $total_files files]"
exit 0
else
echo "❌ FINAL RESULT: Some links are broken. Please review the output above."
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "[Link Checker Complete — found broken links in $total_files files]"
exit 1
fi