Skip to content

Commit 2e4fcca

Browse files
committed
feat: add GitHub token authentication support to aqua-installer
- Add conditional authentication using GITHUB_TOKEN environment variable - Support Bearer token auth for both curl and wget download methods - Maintain backward compatibility with unauthenticated requests - Provide user feedback when authentication is being used - Enables higher rate limits and potential private repository access Resolves unauthenticated GitHub API requests when token is available.
1 parent c780ffb commit 2e4fcca

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

aqua-installer

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,26 @@ URL=https://github.com/aquaproj/aqua/releases/download/$bootstrap_version/$filen
6868
tempdir=$(mktemp -d)
6969
echo "[INFO] Installing aqua $bootstrap_version for bootstrapping..." >&2
7070
echo "[INFO] Downloading $URL ..." >&2
71+
72+
# Prepare authentication header if GITHUB_TOKEN is available
73+
auth_header=""
74+
if [ -n "$GITHUB_TOKEN" ]; then
75+
echo "[INFO] Using GitHub authentication" >&2
76+
auth_header="Authorization: Bearer $GITHUB_TOKEN"
77+
fi
78+
7179
if command -v curl > /dev/null 2>&1; then
72-
curl --retry 5 --fail -L "$URL" -o "$tempdir/$filename"
80+
if [ -n "$auth_header" ]; then
81+
curl --retry 5 --fail -L -H "$auth_header" "$URL" -o "$tempdir/$filename"
82+
else
83+
curl --retry 5 --fail -L "$URL" -o "$tempdir/$filename"
84+
fi
7385
elif command -v wget > /dev/null 2>&1; then
74-
wget -P "$tempdir" "$URL"
86+
if [ -n "$auth_header" ]; then
87+
wget --header="$auth_header" -P "$tempdir" "$URL"
88+
else
89+
wget -P "$tempdir" "$URL"
90+
fi
7591
else
7692
echo "[ERROR] Neither curl nor wget is found. Please install either curl or wget to download aqua" >&2
7793
exit 1

0 commit comments

Comments
 (0)