Update .gitea/actions/test-links/action.yml
This commit is contained in:
@@ -86,10 +86,11 @@ runs:
|
|||||||
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
|
-H "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36" \
|
||||||
"$check_url" 2>/dev/null || echo "000")
|
"$check_url" 2>/dev/null || echo "000")
|
||||||
else
|
else
|
||||||
# Local file - convert to full Gitea URL
|
# Local file - convert to full Gitea URL (keep URL encoding)
|
||||||
if [[ "$link" =~ ^/ ]]; then
|
if [[ "$link" =~ ^/ ]]; then
|
||||||
# Absolute path from repo root
|
# Absolute path from repo root
|
||||||
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH${link}"
|
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
|
else
|
||||||
# Relative path from markdown file
|
# Relative path from markdown file
|
||||||
md_dir=$(dirname "$md_file")
|
md_dir=$(dirname "$md_file")
|
||||||
@@ -99,8 +100,12 @@ runs:
|
|||||||
rel_path="${md_dir#./}/$link"
|
rel_path="${md_dir#./}/$link"
|
||||||
fi
|
fi
|
||||||
check_url="http://gitea:3000/$REPO_OWNER/$REPO_NAME/raw/branch/$GIT_BRANCH/$rel_path"
|
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
|
fi
|
||||||
|
|
||||||
|
# Use display_url for output instead of decoded_link
|
||||||
|
decoded_link="$display_url"
|
||||||
|
|
||||||
# Check URL with curl
|
# Check URL with curl
|
||||||
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$check_url" 2>/dev/null || echo "000")
|
http_code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 10 "$check_url" 2>/dev/null || echo "000")
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user