-
Notifications
You must be signed in to change notification settings - Fork 322
fix: create_pull_request branch guidance, PR-comment tool selection, and shallow clone fallback #24123
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
fix: create_pull_request branch guidance, PR-comment tool selection, and shallow clone fallback #24123
Changes from all commits
15c4775
e5743f7
d50341c
e7cf42c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,4 @@ | ||||||
|
|
||||||
| <pr-comment-tool-guidance> | ||||||
| When triggered by a pull request comment, if you need to push code changes, prefer using `push_to_pull_request_branch` to add commits to the existing pull request branch rather than `create_pull_request` which opens a separate new pull request. Only use `create_pull_request` if the instructions explicitly ask you to create a new, separate pull request. | ||||||
|
||||||
| When triggered by a pull request comment, if you need to push code changes, prefer using `push_to_pull_request_branch` to add commits to the existing pull request branch rather than `create_pull_request` which opens a separate new pull request. Only use `create_pull_request` if the instructions explicitly ask you to create a new, separate pull request. | |
| When triggered by a pull request comment, if you need to push code changes, prefer using `push_to_pull_request_branch` to add commits to the existing pull request branch rather than opening a separate new pull request. Only create a new, separate pull request if the instructions explicitly ask you to do so. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,6 +272,18 @@ func (c *Compiler) collectPromptSections(data *WorkflowData) []PromptSection { | |
| ShellCondition: shellCondition, | ||
| EnvVars: envVars, | ||
| }) | ||
|
|
||
| // When push_to_pull_request_branch is configured, add guidance to prefer it over | ||
| // create_pull_request when the workflow was triggered by a PR comment. | ||
| if data.SafeOutputs != nil && data.SafeOutputs.PushToPullRequestBranch != nil { | ||
| unifiedPromptLog.Print("Adding push-to-PR-branch tool preference guidance for PR comment context") | ||
| sections = append(sections, PromptSection{ | ||
| Content: prContextPushToPRBranchGuidanceFile, | ||
| IsFile: true, | ||
| ShellCondition: shellCondition, | ||
| EnvVars: envVars, | ||
| }) | ||
| } | ||
|
Comment on lines
+276
to
+286
|
||
| } | ||
|
|
||
| return sections | ||
|
|
||
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.
New behavior (explicitly
git fetchingoriginalBaseCommitin shallow clones) isn't covered by the existing tests increate_pull_request.test.cjs. Consider adding a unit test that asserts the fetch is attempted beforegit cat-file -e, and that fetch failures are treated as non-fatal (still proceeding to the local availability check).