Update .gitea/workflows/test-skins.yml
All checks were successful
Test Skins / link-check (push) Successful in 20s
Generate Skin previews, OSK files and per skin documentation / Full CI/CD Pipeline (push) Successful in 29s

This commit is contained in:
2025-11-23 13:11:49 +01:00
parent 7d1e9af996
commit e79fe18c4b

View File

@@ -14,7 +14,7 @@ jobs:
- name: Validate links and assets
shell: bash
run: |
set -euo pipefail
set -uo pipefail
RED="\033[31m"
GREEN="\033[32m"
@@ -30,10 +30,12 @@ jobs:
local url="$1"
echo " → Checking external: $url"
# HEAD request
if curl -Is --max-time 10 "$url" | head -n1 | grep -qE "HTTP/.* (200|30[0-9])"; then
return 0
fi
# GET fallback
if curl -Is --max-time 10 -X GET "$url" | head -n1 | grep -qE "HTTP/.* (200|30[0-9])"; then
return 0
fi
@@ -56,44 +58,38 @@ jobs:
}
extract_links() {
local file="$1"
local f="$1"
grep -oE '\[[^]]*\]\([^)]*\)' "$file" \
grep -oE '\[[^]]*\]\([^)]*\)' "$f" \
| sed -E 's/.*\((.*)\).*/\1/'
grep -oE '!\[[^]]*\]\([^)]*\)' "$file" \
grep -oE '!\[[^]]*\]\([^)]*\)' "$f" \
| sed -E 's/.*\((.*)\).*/\1/'
grep -oE 'https?://[^ )"]+' "$file"
grep -oE 'https?://[^ )"]+' "$f"
grep -oE '<img[^>]*src="[^"]+"' "$file" \
grep -oE '<img[^>]*src="[^"]+"' "$f" \
| sed -E 's/.*src="([^"]*)".*/\1/'
grep -oE '<video[^>]*src="[^"]+"' "$file" \
grep -oE '<video[^>]*src="[^"]+"' "$f" \
| sed -E 's/.*src="([^"]*)".*/\1/'
}
echo "🔍 Scanning Markdown files..."
echo
while IFS= read -r mdfile; do
find . -type f -name '*.md' | while IFS= read -r mdfile; do
echo "📄 Checking: $mdfile"
while IFS= read -r url; do
[[ -z "$url" ]] && continue
[[ "$url" == mailto:* ]] && continue
###
# 🚫 Skip tag-version links inside /docs/*
###
# Skip tag links inside /docs → but **do NOT print them**
if [[ "$mdfile" == ./docs/* ]] && [[ "$url" == *"/src/tag/"* ]]; then
echo " → Skipping tag link (allowed in docs): $url"
continue
fi
###
# Normal link checking
###
if [[ "$url" == http* ]]; then
if ! check_http "$url"; then
ERRORS+=("❌ Broken external link: $url (in $mdfile)")
@@ -107,18 +103,16 @@ jobs:
done < <(extract_links "$mdfile")
echo
done < <(find . -type f -name '*.md')
done
echo
if (( ${#ERRORS[@]} > 0 )); then
echo -e "${RED}✖ Broken Links & Missing Files Found:${RESET}"
for e in "${ERRORS[@]}"; do
echo "$e"
done
echo -e "${RED}✖ Errors found:${RESET}"
printf "%s\n" "${ERRORS[@]}"
echo
echo -e "${RED}⚠️ Job will NOT fail (requested behavior).${RESET}"
echo -e "${RED}❌ Failing job because broken links were found.${RESET}"
exit 1
else
echo -e "${GREEN}✔ All links OK!${RESET}"
fi
exit 0