Fix GitHub API rate limit failures in repository topics check - #2381
Merged
Merged
Conversation
The repository topics check called the GitHub API without authentication. Anonymous requests are limited to 60/hour per IP address, which is shared with other tenants on GitHub-hosted runners and therefore often already exhausted, making the check fail randomly with HTTP 403. Pass GITHUB_TOKEN to the validation step and use it in the topics check (same pattern as pin_description_files_scmrevision.py) so requests count against the workflow token's 5000/hour limit instead. Also raise ExtensionCheckError instead of ValueError on API errors: ValueError is not caught by the check runner loop, so a single failed API request crashed the whole validation run with a traceback instead of being reported as a failed check in the validation report. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR hardens the extension validation “repository topics” check by authenticating GitHub API calls with GITHUB_TOKEN to avoid anonymous rate-limit flakiness on shared runners, and by ensuring API failures are surfaced as check failures rather than crashing the validation run.
Changes:
- Pass
GITHUB_TOKENinto the validation step in the GitHub Actions workflow. - Use
GITHUB_TOKENfor GitHub Topics API requests and raiseExtensionCheckErroron non-200 responses.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scripts/check_description_files.py | Adds optional authenticated GitHub Topics API access and converts HTTP errors into ExtensionCheckError. |
| .github/workflows/extension-validation.yml | Exposes GITHUB_TOKEN to the validation step so API calls use the higher authenticated rate limit. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+262
to
265
| token = os.environ.get("GITHUB_TOKEN", None) | ||
| if token: | ||
| headers["Authorization"] = f"token {token}" | ||
| response = requests.get(url, headers=headers) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The repository topics check called the GitHub API without authentication. Anonymous requests are limited to 60/hour per IP address, which is shared with other tenants on GitHub-hosted runners and therefore often already exhausted, making the check fail randomly with HTTP 403.
Pass GITHUB_TOKEN to the validation step and use it in the topics check (same pattern as pin_description_files_scmrevision.py) so requests count against the workflow token's 5000/hour limit instead.
Also raise ExtensionCheckError instead of ValueError on API errors: ValueError is not caught by the check runner loop, so a single failed API request crashed the whole validation run with a traceback instead of being reported as a failed check in the validation report.