Skip to content

Commit a68cf35

Browse files
committed
scripts: west_commands: Log a hint for rate-limit failure during install
`west sdk install` may fail with a GitHub API rate-limit (HTTP 403) error. This typically occurs when the command is run multiple times after previous failures, which is common for new users setting up the project. Currently, the thrown exception only links to a generic GitHub rate-limit documentation page, which may be confusing to users. Users can bypass the rate limit by authenticating with GitHub using a Personal Access Token. The install script supports this via the `--personal-access-token` argument. Therefore, detect rate-limit related failures and print a helpful message suggesting the use of this argument. Signed-off-by: Beleswar Prasad Padhi <[email protected]>
1 parent 4758cfa commit a68cf35

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/west_commands/sdk.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ def fetch_releases(self, url, req_headers):
247247
params = {"page": page, "per_page": 100}
248248
resp = requests.get(url, headers=req_headers, params=params)
249249
if resp.status_code != 200:
250+
rate_limit_log = "API rate limit exceeded"
251+
if rate_limit_log in resp.text:
252+
self.inf(f"fetch_releases {rate_limit_log}. Try executing install script with --personal-access-token argument")
250253
raise Exception(f"Failed to fetch: {resp.status_code}, {resp.text}")
251254

252255
data = resp.json()

0 commit comments

Comments
 (0)