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.
fix: 自动 revert 兼容路径(内容 API,.github #91,ADR-0041) #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
fix: 自动 revert 兼容路径(内容 API,.github #91,ADR-0041) #179
Changes from all commits
4d11d06File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3. Revert pr 为空 diff
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4. Rename 无法正确回滚
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
6. 吞错导致部分回滚
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5. Base64 换行未清理
🐞 Bug☼ ReliabilityAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 12087
🌐 Web query:
GitHub REST API Contents endpoint empty file response content field create or update file contents branch ref SHA documentation💡 Result:
When using the GitHub REST API "Get repository content" endpoint to retrieve a file, the
contentfield in the JSON response contains the file's contents, typically base64-encoded [1][2]. However, thecontentfield will be an empty string if the file size is between 1 MB and 100 MB [1][3]. In this case, theencodingfield is set to "none" [1][4]. To retrieve the full content for files of this size, you must use the raw media type (e.g., by setting theAcceptheader toapplication/vnd.github.raw) [1][5]. Regarding creating or updating file contents (the "Create or update file contents" endpoint), theshaparameter is required when updating an existing file [2]. Thisshamust correspond to the blob SHA of the file you are updating [1]. If you are creating a new file, theshaparameter is not required [2]. You can specify a branch using thebranchparameter; if omitted, the repository's default branch is used [1][2]. For more advanced Git reference operations, such as creating or updating branch pointers (independent of specific file contents), you can use the Git Database API's References endpoint [6][7]. In that context, therefparameter specifies the reference (e.g.,heads/branch-name) and theshaparameter specifies the commit hash that the reference should point to [6][7].Citations:
🌐 Web query:
GitHub REST API create a reference refs heads sha commit branch points to commit tree documentation💡 Result:
To create a new branch or reference in a GitHub repository using the GitHub REST API, you use the Create a reference endpoint [1]. Endpoint: POST /repos/{owner}/{repo}/git/refs Required Parameters: - ref: The name of the fully qualified reference (e.g., refs/heads/branch-name). It must start with "refs/" and contain at least two slashes [1]. - sha: The SHA-1 hash of the commit that the new reference should point to [1]. Request Example: curl -L \ -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer YOUR_TOKEN" \ https://api.github.com/repos/OWNER/REPO/git/refs \ -d '{"ref": "refs/heads/featureA", "sha": "aa218f56b14c9653891f9e74264a383fa43fefbd"}' Key Considerations: - Empty Repositories: You cannot create references in an empty repository (a repository without any branches). You must first initialize the repository by creating content (e.g., via the contents API) [1][2]. - SHA Validation: The provided SHA must exist in the repository's Git database, or the request will fail with a 422 error [1]. - Authentication: You should include an appropriate authorization header (e.g., Bearer token) and it is recommended to use the application/vnd.github+json media type [1].
Citations:
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 280
🏁 Script executed:
Repository: Cloudbird-Software/.github
Length of output: 298
修正基于 Contents API 的逐文件恢复逻辑
行 105 已将
$BR指向$PARENT,因此分支树已经是父提交状态。后续循环会产生冗余 API 调用和提交。[ -n "$PC" ]不能判断文件是否存在:空文件以及 1–100 MB 文件的.content可能为空,循环会错误执行DELETE。若目标是完整回滚,请移除该循环;若目标是选择性恢复,请从$SHA创建$BR,并使用文件元数据判断存在性,再通过适合大文件的 API 获取内容。🤖 Prompt for AI Agents