-
Notifications
You must be signed in to change notification settings - Fork 35
Fix/install script rate limit handling #354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,12 +9,21 @@ case "${ARCH}" in | |
| aarch64) ARCH="arm64" ;; | ||
| esac | ||
|
|
||
| # Get the appropriate download URL for this platform | ||
| DOWNLOAD_URL="$(curl -s https://api.github.com/repos/brevdev/brev-cli/releases/latest | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)" | ||
| # Fetch release metadata from GitHub API | ||
| API_RESPONSE="$(curl -sf ${GITHUB_TOKEN:+-H "Authorization: token ${GITHUB_TOKEN}"} https://api.github.com/repos/brevdev/brev-cli/releases/latest)" || { | ||
| echo "Error: Failed to fetch release info from GitHub API." >&2 | ||
| echo "This is often caused by rate limiting when many requests come from the same IP." >&2 | ||
| echo "If you are using a VPN, try turning it off and running this script again." >&2 | ||
| echo "You can also set GITHUB_TOKEN to avoid rate limits." >&2 | ||
| echo "For more details, see: https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting" >&2 | ||
| exit 1 | ||
| } | ||
|
|
||
| # Verify we found a suitable release | ||
| # Extract the download URL for this platform | ||
| DOWNLOAD_URL="$(echo "${API_RESPONSE}" | grep "browser_download_url.*${OS}.*${ARCH}" | cut -d '"' -f 4)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bit of a corner case but since we have both
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used Claude to add a |
||
| if [ -z "${DOWNLOAD_URL}" ]; then | ||
| echo "Error: Could not find release for ${OS} ${ARCH}" >&2 | ||
| echo "GitHub API response (truncated): ${API_RESPONSE:0:200}" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anything use this file anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't look like it. I'll remove.