Update .gitea/actions/test-links/action.yml

This commit is contained in:
2025-11-23 15:12:42 +01:00
parent 23c8565f41
commit 6593bbdfbc

View File

@@ -86,10 +86,11 @@ runs:
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
"$check_url" 2>/dev/null || echo "000")
else
# Local file - convert to full Gitea URL
# Local file - convert to full Gitea URL (keep URL encoding)
if [[ "$link" =~ ^/ ]]; then
# Absolute path from repo root
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH${link}"
display_url="https://git.sulej.net/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH${link}"
else
# Relative path from markdown file
md_dir=$(dirname "$md_file")
@@ -99,8 +100,12 @@ runs:
rel_path="${md_dir#./}/$link"
fi
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH/$rel_path"
display_url="https://git.sulej.net/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH/$rel_path"
fi
# Use display_url for output instead of decoded_link
decoded_link="$display_url"
# Check URL with curl
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$check_url" 2>/dev/null || echo "000")
fi