generated from osc/skins-template
Update .gitea/workflows/test-skins.yml
This commit is contained in:
@@ -165,11 +165,11 @@ jobs:
|
|||||||
file_has_errors=0
|
file_has_errors=0
|
||||||
|
|
||||||
# Extract ALL links from the markdown file
|
# Extract ALL links from the markdown file
|
||||||
# Match both []() and direct URLs
|
# Match both []() and direct URLs - using Perl regex for better handling
|
||||||
grep -oP '\[([^\]]+)\]\(([^\)]+)\)' "$md_file" | sed 's/\[.*\](\(.*\))/\1/' > /tmp/links_$$.txt || true
|
grep -oP '\]\(([^\)]+)\)' "$md_file" | sed 's/](\(.*\))/\1/' > /tmp/links_$$.txt || true
|
||||||
|
|
||||||
# Also extract image links
|
# Also extract image links
|
||||||
grep -oP '!\[([^\]]*)\]\(([^\)]+)\)' "$md_file" | sed 's/!\[.*\](\(.*\))/\1/' >> /tmp/links_$$.txt || true
|
grep -oP '!\[[^\]]*\]\(([^\)]+)\)' "$md_file" | sed 's/!\[.*\](\(.*\))/\1/' >> /tmp/links_$$.txt || true
|
||||||
|
|
||||||
link_count=$(wc -l < /tmp/links_$$.txt)
|
link_count=$(wc -l < /tmp/links_$$.txt)
|
||||||
|
|
||||||
@@ -184,16 +184,19 @@ jobs:
|
|||||||
|
|
||||||
# Check each link
|
# Check each link
|
||||||
while IFS= read -r link; do
|
while IFS= read -r link; do
|
||||||
|
[ -z "$link" ] && continue
|
||||||
|
|
||||||
# Decode URL-encoded characters
|
# Decode URL-encoded characters
|
||||||
decoded_link=$(echo "$link" | sed 's/%20/ /g' | sed 's/%23/#/g' | sed 's/%28/(/g' | sed 's/%29/)/g' | sed 's/%E2%80%A2/•/g' | sed 's/%E1%9A%96/ᚖ/g' | sed 's/%E3%80%8A/《/g' | sed 's/%E3%80%8B/》/g' | sed 's/%E3%80%8E/『/g' | sed 's/%E3%80%8F/』/g' | sed 's/%E2%9B%94/⛔/g' | sed 's/%E2%9C%A8/✨/g' | sed 's/%7B/{/g' | sed 's/%7D/}/g' | sed 's/%2B/+/g' | sed 's/%E3%83%86/テ/g' | sed 's/%E3%83%B3/ン/g' | sed 's/%E3%83%8D/ネ/g' | sed 's/%E3%82%B9/ス/g' | sed 's/%E3%82%A4/イ/g' | sed 's/%E3%83%BB/・/g' | sed 's/%E3%83%95/フ/g' | sed 's/%E3%83%AA/リ/g' | sed 's/%E3%83%BC/ー/g' | sed 's/%E3%83%8A/ナ/g' | sed 's/%5B/[/g' | sed 's/%5D/]/g')
|
decoded_link=$(echo "$link" | sed 's/%20/ /g' | sed 's/%23/#/g' | sed 's/%28/(/g' | sed 's/%29/)/g' | sed 's/%E2%80%A2/•/g' | sed 's/%E1%9A%96/ᚖ/g' | sed 's/%E3%80%8A/《/g' | sed 's/%E3%80%8B/》/g' | sed 's/%E3%80%8E/『/g' | sed 's/%E3%80%8F/』/g' | sed 's/%E2%9B%94/⛔/g' | sed 's/%E2%9C%A8/✨/g' | sed 's/%7B/{/g' | sed 's/%7D/}/g' | sed 's/%2B/+/g' | sed 's/%E3%83%86/テ/g' | sed 's/%E3%83%B3/ン/g' | sed 's/%E3%83%8D/ネ/g' | sed 's/%E3%82%B9/ス/g' | sed 's/%E3%82%A4/イ/g' | sed 's/%E3%83%BB/・/g' | sed 's/%E3%83%95/フ/g' | sed 's/%E3%83%AA/リ/g' | sed 's/%E3%83%BC/ー/g' | sed 's/%E3%83%8A/ナ/g' | sed 's/%5B/[/g' | sed 's/%5D/]/g')
|
||||||
|
|
||||||
# Check if it's an external URL
|
# Check if it's an external URL
|
||||||
if [[ "$decoded_link" =~ ^https?:// ]]; then
|
if [[ "$decoded_link" =~ ^https?:// ]]; then
|
||||||
# Check external URL with curl
|
# Check external URL with curl
|
||||||
if curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$decoded_link" | grep -q "^[23]"; then
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$decoded_link" 2>/dev/null)
|
||||||
|
if [[ "$http_code" =~ ^2[0-9][0-9]$ ]] || [[ "$http_code" =~ ^3[0-9][0-9]$ ]]; then
|
||||||
echo " ✅ $decoded_link"
|
echo " ✅ $decoded_link"
|
||||||
else
|
else
|
||||||
echo " ❌ $decoded_link (URL not accessible)"
|
echo " ❌ $decoded_link (HTTP $http_code)"
|
||||||
file_has_errors=1
|
file_has_errors=1
|
||||||
has_errors=1
|
has_errors=1
|
||||||
fi
|
fi
|
||||||
@@ -207,13 +210,11 @@ jobs:
|
|||||||
file_path="$md_dir/$decoded_link"
|
file_path="$md_dir/$decoded_link"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize path
|
# Check if file exists (using test -f which handles spaces better)
|
||||||
file_path=$(realpath -m "$file_path" 2>/dev/null || echo "$file_path")
|
|
||||||
|
|
||||||
if [ -f "$file_path" ]; then
|
if [ -f "$file_path" ]; then
|
||||||
echo " ✅ $decoded_link"
|
echo " ✅ $decoded_link"
|
||||||
else
|
else
|
||||||
echo " ❌ $decoded_link (file not found: $file_path)"
|
echo " ❌ $decoded_link (file not found at: $file_path)"
|
||||||
file_has_errors=1
|
file_has_errors=1
|
||||||
has_errors=1
|
has_errors=1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user