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