Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b820e7b5-cce6-4be8-8217-691358bf8f5c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b820e7b5-cce6-4be8-8217-691358bf8f5c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
push_to_pull_request_branch by scoping git ops to target repo cwd
|
Hey One thing worth noting: this repository doesn't have a The only thing to double-check before requesting a full review: the PR is currently in draft state — flip it to "Ready for review" once you're satisfied with the changes.
|
There was a problem hiding this comment.
Pull request overview
Improves push_to_pull_request_branch behavior in multi-repo workflows by scoping git branch detection and incremental patch/bundle generation to the checked-out target repo directory (when provided), and adds test coverage for that path.
Changes:
- Resolve target repo checkout path and use it for branch detection (
getCurrentBranch(repoCwd)). - Pass
cwdinto incremental patch/bundle generation options so git operations run in the target repo checkout. - Add a Vitest case that creates a side-repo checkout and verifies branch detection uses that repo’s context.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/safe_outputs_handlers.cjs | Adds repo checkout resolution and scopes branch detection + patch/bundle git operations via cwd. |
| actions/setup/js/safe_outputs_handlers.test.cjs | Adds test validating branch detection in a side-repo checkout when repo is specified. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
| if (checkoutResult.success) { | ||
| repoCwd = checkoutResult.path; | ||
| entry.repo_cwd = repoCwd; | ||
| } |
There was a problem hiding this comment.
When entry.repo is provided but findRepoCheckout(repoSlug) fails, the handler silently falls back to running git operations in the workflow repo (or workspace root). This can yield incorrect branch detection/patch generation and can also cause getCurrentBranch(repoCwd) to throw if the workflow cwd is not a git repo. Align behavior with createPullRequestHandler by returning a clear error (and guidance to use actions/checkout with path) when the target repo checkout cannot be found, rather than proceeding with repoCwd = null.
| if (checkoutResult.success) { | |
| repoCwd = checkoutResult.path; | |
| entry.repo_cwd = repoCwd; | |
| } | |
| if (!checkoutResult.success) { | |
| return { | |
| content: [ | |
| { | |
| type: "text", | |
| text: JSON.stringify({ | |
| result: "error", | |
| error: `Repository checkout not found for ${repoSlug}. Ensure the repository is checked out in this workflow using actions/checkout. If checking out multiple repositories, use the 'path' input so the checkout can be located.`, | |
| }), | |
| }, | |
| ], | |
| isError: true, | |
| }; | |
| } | |
| repoCwd = checkoutResult.path; | |
| entry.repo_cwd = repoCwd; |
| // Build common options for both patch and bundle generation | ||
| const pushTransportOptions = { mode: "incremental" }; | ||
| if (repoCwd) { | ||
| pushTransportOptions.cwd = repoCwd; |
There was a problem hiding this comment.
pushTransportOptions sets cwd for multi-repo, but it never sets repoSlug. Both generateGitPatch and generateGitBundle support options.repoSlug to disambiguate filenames in /tmp/gh-aw/ for multi-repo workflows; without it, two repos with the same branch name can overwrite each other’s patch/bundle files. Consider setting pushTransportOptions.repoSlug = repoResult.repo when operating in multi-repo mode (similar to createPullRequestHandler).
| pushTransportOptions.cwd = repoCwd; | |
| pushTransportOptions.cwd = repoCwd; | |
| pushTransportOptions.repoSlug = repoResult.repo; |
🧪 Test Quality Sentinel ReportTest Quality Score: 100/100✅ Excellent test quality
Test Classification Details
Test Analysis✅
|
|
@copilot review all comments |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/3d4592c5-001e-4e65-a7c5-bc9e7e7779e3 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed all actionable review comments in b7a93af: |
|
@copilot add tests as you do a deep review |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9cbfebfe-a9d7-42d9-9e47-accf291cc24b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…artifacts Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9cbfebfe-a9d7-42d9-9e47-accf291cc24b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9cbfebfe-a9d7-42d9-9e47-accf291cc24b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9cbfebfe-a9d7-42d9-9e47-accf291cc24b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/9cbfebfe-a9d7-42d9-9e47-accf291cc24b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented a deeper review with additional targeted tests in |
| repoCwd = checkoutResult.path; | ||
| entry.repo_cwd = repoCwd; | ||
| } | ||
|
|
There was a problem hiding this comment.
Added the checkout-folder debug log in 2c81766 and covered it with a targeted test assertion. Screenshot: N/A (no UI changes).
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/65de9894-1f7e-4563-8ebd-4b7c9dc64854 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
push_to_pull_request_branchwas executing git commands from the workflow repo root, which breaks multi-repo workflows that checkout the target repo into a subdirectory (actions/checkoutwithpath). This caused wrong branch detection and incremental patch generation against the wrong/local-missing branch context.Repo checkout resolution for push handler
push_to_pull_request_branchusingfindRepoCheckout(repoResult.repo)whenentry.repois provided.entry.repo_cwd) for downstream visibility.actions/checkout+pathguidance) when an explicitentry.repocheckout cannot be found, instead of falling back to the workflow repo.Branch detection now uses target repo context
getCurrentBranch()getCurrentBranch(repoCwd)create_pull_requestand prevents reading branch state from the workflow repo.Incremental patch/bundle generation now runs in target repo
cwdtopushTransportOptionswhen a target checkout is resolved.repoSlugtopushTransportOptionsin multi-repo mode to disambiguate generated patch/bundle filenames under/tmp/gh-aw/.git fetch, branch existence checks, and incremental patch generation execute in the checked-out target repo, notprocess.cwd().Coverage for multi-repo behavior
branch: "main", and verifies the handler detects the feature branch from that repo context.