fix(github): Fall back to git blobs API for large files in GetFileContent#6401
Merged
jamengual merged 5 commits intoApr 21, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a fallback in GetFileContent to use the Git Blobs API when the GitHub Contents API omits content for files over 1MB, preventing base64 decode failures and unblocking skip-clone-no-changes.
Changes:
- Add Contents API → Blobs API fallback when the Contents response has empty/missing
content. - Add unit tests covering normal file, not found, and large-file fallback behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| server/events/vcs/github/client.go | Implements Blobs API fallback when Contents API returns empty content for large files. |
| server/events/vcs/github/client_test.go | Adds tests validating normal, not-found, and large-file fallback behavior. |
0bab2e4 to
64b1dad
Compare
lukemassa
approved these changes
Apr 19, 2026
64b1dad to
009591b
Compare
…tent Signed-off-by: Jaycee Hua <jbernardino@moveworks.ai>
009591b to
09da15d
Compare
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.
what
GetFileContenton the GitHub client now falls back to the Git Blobs API when a file exceeds GitHub's 1MB Contents API limitskip-clone-no-changesfeature, which usesGetFileContentto fetchatlantis.yamlbefore deciding whether to clonewhy
GET /repos/{owner}/{repo}/contents/{path}API returns an emptycontentfield for files larger than 1MB, causingskip-clone-no-changesto fail with a base64 decode errorGET /repos/{owner}/{repo}/git/blobs/{sha}) has no size limit and returns the same base64-encoded content — the SHA needed to call it is already present in the Contents API responsetests
TestClient_GetFileContentwith three cases: normal file, file not found, and file over 1MB triggering the blobs fallbackreferences