Skip to content

fix(ci): use GITHUB_TOKEN in check-vendored-yaml to avoid rate limits#252

Open
marythought wants to merge 2 commits intomainfrom
fix/check-vendored-yaml-rate-limit
Open

fix(ci): use GITHUB_TOKEN in check-vendored-yaml to avoid rate limits#252
marythought wants to merge 2 commits intomainfrom
fix/check-vendored-yaml-rate-limit

Conversation

@marythought
Copy link
Contributor

Summary

  • Authenticates GitHub API requests in check-vendored-yaml using the GITHUB_TOKEN env var (already passed by both CI workflows)
  • Adds HTTP status code checking in fetchJson — previously a 403 rate-limit response was silently parsed as JSON and passed to a for...of loop, causing a cryptic TypeError: contents is not iterable
  • Validates that the Contents API response is an array before iterating

Root cause: The script makes unauthenticated requests to the GitHub Contents API (60 req/hr limit). In CI, multiple concurrent jobs or rapid re-runs exhaust this limit, causing the build step to fail with an unhelpful error.

Fix: Use GITHUB_TOKEN for authenticated requests (5,000 req/hr), and fail with a clear error message if the API still returns a non-200 status.

Test plan

  • CI build passes (check-vendored-yaml uses GITHUB_TOKEN)
  • Local npm run check-vendored-yaml still works (gracefully handles missing token with clear error)
  • Verify error message is clear when rate-limited (shows status code and response body)

🤖 Generated with Claude Code

The check-vendored-yaml script hits the GitHub Contents API without
authentication, causing rate-limit failures (403) in CI. The error
manifested as a cryptic "contents is not iterable" TypeError because
fetchJson didn't check HTTP status codes.

Changes:
- Use GITHUB_TOKEN env var for authenticated API requests (already
  passed by CI workflows, raises rate limit from 60 to 5000 req/hr)
- Add HTTP status code checking in fetchJson with clear error messages
- Validate that Contents API response is an array before iterating

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@marythought marythought requested review from a team as code owners March 18, 2026 17:37
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses and resolves issues related to GitHub API rate limiting in the check-vendored-yaml script. By incorporating authenticated requests and robust error handling, it ensures the script's reliability in CI environments and provides more informative feedback when API calls encounter problems, preventing build failures due to exhausted rate limits or malformed responses.

Highlights

  • GitHub API Authentication: Implemented the use of GITHUB_TOKEN environment variable for authenticating GitHub API requests within the check-vendored-yaml script, increasing the rate limit from 60 to 5,000 requests per hour.
  • Improved Error Handling: Added explicit HTTP status code checking in the fetchJson function to catch non-200 responses (like 403 rate limits) and provide clear error messages, preventing cryptic TypeError issues.
  • API Response Validation: Introduced validation to ensure that the GitHub Contents API response is an array before iteration, further enhancing robustness against unexpected API responses.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request enhances the check-vendored-yaml.ts script by introducing support for GitHub authentication via GITHUB_TOKEN for API requests, improving error handling for non-200 HTTP responses, and adding validation for the GitHub Contents API response type. A review comment highlights an opportunity to improve type safety by removing unnecessary as any casts and explicit any types in the https.get calls.

@github-actions
Copy link
Contributor

📄 Preview deployed to https://opentdf-docs-pr-252.surge.sh

@marythought marythought enabled auto-merge (squash) March 18, 2026 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant