Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates base-branch resolution so cross-repo PR operations resolve the base branch against the configured target repository (not the workflow repo), and threads that base branch into patch generation.
Changes:
- Add an optional
targetRepoparameter togetBaseBranch()so issue_comment PR base lookups can query the correct repository. - Make
generateGitPatch()take an explicitbaseBranchargument and update callers/tests accordingly. - Resolve the configured target repo (via
repo_helpers) in safe-output handlers and other entrypoints before callinggetBaseBranch().
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/safe_outputs_handlers.test.cjs | Adds a mocked global.context needed by target-repo resolution in handler tests. |
| actions/setup/js/safe_outputs_handlers.cjs | Resolves target repo before calling getBaseBranch() and passes resolved base branch into generateGitPatch(). |
| actions/setup/js/push_to_pull_request_branch.cjs | Parses configured target repo and passes it into getBaseBranch() for cross-repo correctness. |
| actions/setup/js/git_patch_integration.test.cjs | Updates integration tests to pass an explicit base branch into generateGitPatch(). |
| actions/setup/js/get_base_branch.test.cjs | Adds coverage for the new optional targetRepo parameter. |
| actions/setup/js/get_base_branch.cjs | Implements targetRepo support for issue_comment PR base-branch API lookup. |
| actions/setup/js/generate_git_patch.test.cjs | Updates tests for the new generateGitPatch(branch, baseBranch, options) signature. |
| actions/setup/js/generate_git_patch.cjs | Changes patch generation to rely on a caller-provided base branch (no internal getBaseBranch() lookup). |
| actions/setup/js/create_pull_request.cjs | Parses configured target repo and passes it into getBaseBranch() for cross-repo correctness. |
| actions/setup/js/create_agent_session.cjs | Parses configured target repo and passes it into getBaseBranch() for cross-repo correctness. |
Comments suppressed due to low confidence (1)
actions/setup/js/safe_outputs_handlers.cjs:199
- resolveTargetRepoConfig() ultimately falls back to
context.repo(repo_helpers.getDefaultTargetRepo). In the MCP server entrypoint (safe-outputs-mcp-server.cjs), onlyglobal.coreis shimmed (shim.cjs) andglobal.contextis not set, so invokingcreate_pull_requestvia the MCP server can throw a ReferenceError when notarget-repo/GH_AW_TARGET_REPO_SLUG is configured. Consider adding a local fallback here (e.g., preferprConfig["target-repo"], thenprocess.env.GH_AW_TARGET_REPO_SLUG, thenprocess.env.GITHUB_REPOSITORY) and/or explicitly error with ERR_CONFIG when none are available instead of relying oncontext.
// Resolve target repo for base branch resolution (cross-repo scenarios)
const prConfig = config.create_pull_request || {};
const { defaultTargetRepo } = resolveTargetRepoConfig(prConfig);
const targetRepoParts = parseRepoSlug(defaultTargetRepo);
const baseBranch = await getBaseBranch(targetRepoParts);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
For cross-repo PRs,
getBaseBranch()needed to become dependent on the target repoThis does structural work to get that to happen