Update .gitea/workflows/test-skins.yml

This commit is contained in:
2025-11-23 14:29:00 +01:00
parent 07fd305c12
commit 0171b14a36

View File

@@ -141,6 +141,7 @@ jobs:
- name: Check all links in markdown files
run: |
#!/bin/bash
set -o pipefail
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
@@ -166,12 +167,12 @@ jobs:
# Extract ALL links from the markdown file
# 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" 2>/dev/null | sed 's/](\(.*\))/\1/' || true
grep -oP '!\[[^\]]*\]\(([^\)]+)\)' "$md_file" 2>/dev/null | sed 's/!\[.*\](\(.*\))/\1/' || true
} > /tmp/links_$$.txt
# Also extract image links
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 2>/dev/null || echo "0")
if [ $link_count -eq 0 ]; then
echo " No links found in this file"
@@ -191,9 +192,17 @@ jobs:
# Check if it's an external URL
if [[ "$decoded_link" =~ ^https?:// ]]; then
# Check external URL with curl
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
# URL-encode the link for curl (convert spaces and special chars)
# Use the original encoded link, not the decoded one
encoded_url="$link"
# Check external URL with curl (with User-Agent header for better compatibility)
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 \
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
"$encoded_url" 2>/dev/null || echo "000")
# Accept 2xx and 3xx status codes as valid
if [[ "$http_code" =~ ^[23][0-9][0-9]$ ]]; then
echo " ✅ $decoded_link"
else
echo " ❌ $decoded_link (HTTP $http_code)"