update default repo to main

This commit is contained in:
yusing
2025-02-23 13:31:27 +08:00
parent 03ea9bb760
commit c5cf867cd9
4 changed files with 25 additions and 25 deletions

View File

@@ -21,26 +21,26 @@ fi
echo "Using ${DOWNLOAD_TOOL} for downloads"
get_default_branch() {
local repo="$1" # Format: owner/repo
local branch
# get_default_branch() {
# local repo="$1" # Format: owner/repo
# local branch
if [ "$DOWNLOAD_TOOL" = "curl" ]; then
branch=$(curl -sL "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
elif [ "$DOWNLOAD_TOOL" = "wget" ]; then
branch=$(wget -qO- "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
fi
# if [ "$DOWNLOAD_TOOL" = "curl" ]; then
# branch=$(curl -sL "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
# elif [ "$DOWNLOAD_TOOL" = "wget" ]; then
# branch=$(wget -qO- "https://api.github.com/repos/${repo}" | grep -o '"default_branch": *"[^"]*"' | cut -d'"' -f4)
# fi
if [ -z "$branch" ]; then
echo "main" # Fallback to 'main' if detection fails
else
echo "$branch"
fi
}
# if [ -z "$branch" ]; then
# echo "main" # Fallback to 'main' if detection fails
# else
# echo "$branch"
# fi
# }
# Environment variables with defaults
REPO="yusing/go-proxy"
BRANCH=${BRANCH:-$(get_default_branch "$REPO")}
BRANCH=${BRANCH:-"main"}
REPO_URL="https://github.com/$REPO"
WIKI_URL="${REPO_URL}/wiki"
BASE_URL="${REPO_URL}/raw/${BRANCH}"