fix: download schema via REST API to avoid raw.githubusercontent.com 429s - #264
Draft
stekern wants to merge 2 commits into
Draft
fix: download schema via REST API to avoid raw.githubusercontent.com 429s#264stekern wants to merge 2 commits into
stekern wants to merge 2 commits into
Conversation
…429s Unauthenticated fetches from raw.githubusercontent.com are rate-limited per IP, and GitHub-hosted runners share egress IPs, so schema validation failed intermittently with HTTP 429. Download the schema through the REST API instead, where the workflow token has its own per-repository rate limit. Also replace pip install with uvx.
Use = instead of the bash-only == in tests, and a case statement instead of [[ ]] glob matching for the URL prefix check.
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.
Problem
build-gp-configletscheck-jsonschemadownload the schema referenced by the config's$schemaproperty directly from raw.githubusercontent.com. Unauthenticated requests to that host are rate-limited per IP, and GitHub-hosted runners share egress IPs with other tenants, so validation fails intermittently with HTTP 429 regardless of our own usage:Sending an auth token does not help — raw.githubusercontent.com ignores tokens for rate-limiting purposes (see this community discussion).
Fix
$schemais a raw.githubusercontent.com URL, download the schema through the REST API contents endpoint instead (Accept: application/vnd.github.raw), where the workflow token gets its own documented per-repository rate limit, then validate against the local copy. Local file paths (used by the CI tests here) pass through unchanged.OWNER/REPO/REF/PATH) andrefs/heads/- /refs/tags/-prefixed raw URL forms; unparseable URLs fail with a clear error.pip install check-jsonschemawithuvx, isolated from the runner's system Python (the action already installs uv). The Renovate pin comment still matches the custom regex manager.Notes
refs/heads/feature/foo) are inherently ambiguous in raw URLs and are not supported; the failure is loud, and schema URLs use single-segment tags by convention.$refs would no longer resolve; the gp-cicd schema only uses internal#/$defs/refs today.