From af1f9472f5a001bfe8ecc0e31d0225c884414523 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Apr 2026 00:57:02 +0000 Subject: [PATCH 1/2] Initial plan From 94c700897052d9f5d3f948b310d96bf0592dbcf9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 25 Apr 2026 01:03:37 +0000 Subject: [PATCH 2/2] docs: remove same-repo only from push-to-pull-request-branch, add cross-repo setup instructions Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ae097dd6-28a0-42c5-8241-4ef1e7663220 Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com> --- .../docs/reference/cross-repository.md | 6 +++++ .../reference/safe-outputs-pull-requests.md | 25 +++++++++++++++++++ .../content/docs/reference/safe-outputs.md | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/docs/src/content/docs/reference/cross-repository.md b/docs/src/content/docs/reference/cross-repository.md index 16bb723a38a..b2ff92a5a00 100644 --- a/docs/src/content/docs/reference/cross-repository.md +++ b/docs/src/content/docs/reference/cross-repository.md @@ -109,6 +109,12 @@ When `allowed-repos` is specified: - Target repository (from `target-repo` or current repo) is always implicitly allowed - Creates a union of allowed destinations +### Checkout Requirement for `push-to-pull-request-branch` + +Unlike other safe output types, `push-to-pull-request-branch` with `target-repo` requires the target repository to be **checked out into the workflow workspace** using the `checkout:` frontmatter field with a `path:` specified. Without a checkout, the agent has no local git history to create and push a patch from. + +See the [Scheduled Push to Pull-Request Branch](#example-scheduled-push-to-pull-request-branch) example and the [Push to PR Branch cross-repo usage](/gh-aw/reference/safe-outputs-pull-requests/#cross-repo-usage) documentation for a complete setup. + ## Examples ### Example: Monorepo Development diff --git a/docs/src/content/docs/reference/safe-outputs-pull-requests.md b/docs/src/content/docs/reference/safe-outputs-pull-requests.md index 4348afccde5..f59cd7efa13 100644 --- a/docs/src/content/docs/reference/safe-outputs-pull-requests.md +++ b/docs/src/content/docs/reference/safe-outputs-pull-requests.md @@ -264,10 +264,35 @@ safe-outputs: ignore-missing-branch-failure: false # treat deleted/missing branch errors as skipped instead of failed (default: false) check-branch-protection: true # set to false to skip the branch protection pre-flight check (default: true) protected-files: fallback-to-issue # create review issue if protected files modified + target-repo: "owner/repo" # cross-repository (target repo must be checked out) + allowed-repos: ["org/repo1"] # additional allowed repositories ``` When `push-to-pull-request-branch` is configured, git commands (`checkout`, `branch`, `switch`, `add`, `rm`, `commit`, `merge`) are automatically enabled. +### Cross-repo usage + +`push-to-pull-request-branch` supports pushing to pull requests in a different repository via `target-repo` (and optionally `allowed-repos`). When `target-repo` is set, **the target repository must be checked out into the workflow workspace** using the `checkout:` frontmatter field with a `path:` specified. + +```yaml wrap +checkout: + - fetch-depth: 0 # checkout current (source) repo + - repository: org/target-repo + path: ./target-repo # must set path for cross-repo checkout + github-token: ${{ secrets.CROSS_REPO_PAT }} + fetch: ["refs/pulls/open/*"] # fetch all open PR branches + +safe-outputs: + github-token: ${{ secrets.CROSS_REPO_PAT }} + push-to-pull-request-branch: + target-repo: "org/target-repo" + title-prefix: "[bot] " +``` + +The `path:` field is required so the agent knows where the target repository is mounted in the workspace. Without a `path`, the checkout action writes to the root of the workspace and overwrites the source repository, which will cause the workflow to fail. + +See [Cross-Repository Operations](/gh-aw/reference/cross-repository/) for a complete example and documentation on `target-repo`, `allowed-repos`, and cross-repository authentication. + Like `create-pull-request`, pushes with GitHub Agentic Workflows do not trigger CI. See [Triggering CI](/gh-aw/reference/triggering-ci/) for how to enable automatic CI triggers. ## Add Reviewer (`add-reviewer:`) diff --git a/docs/src/content/docs/reference/safe-outputs.md b/docs/src/content/docs/reference/safe-outputs.md index bacc031a1c8..26fbdcbf106 100644 --- a/docs/src/content/docs/reference/safe-outputs.md +++ b/docs/src/content/docs/reference/safe-outputs.md @@ -39,7 +39,7 @@ The agent requests issue creation; a separate job with `issues: write` creates i - [**Reply to PR Review Comment**](/gh-aw/reference/safe-outputs-pull-requests/#reply-to-pr-review-comment-reply-to-pull-request-review-comment) (`reply-to-pull-request-review-comment`) - Reply to existing review comments (max: 10) - [**Resolve PR Review Thread**](/gh-aw/reference/safe-outputs-pull-requests/#resolve-pr-review-thread-resolve-pull-request-review-thread) (`resolve-pull-request-review-thread`) - Resolve review threads after addressing feedback (max: 10) - [**Add Reviewer**](/gh-aw/reference/safe-outputs-pull-requests/#add-reviewer-add-reviewer) (`add-reviewer`) - Add reviewers to pull requests (max: 3) -- [**Push to PR Branch**](/gh-aw/reference/safe-outputs-pull-requests/#push-to-pr-branch-push-to-pull-request-branch) (`push-to-pull-request-branch`) - Push changes to PR branch (default max: 1, configurable, same-repo only) +- [**Push to PR Branch**](/gh-aw/reference/safe-outputs-pull-requests/#push-to-pr-branch-push-to-pull-request-branch) (`push-to-pull-request-branch`) - Push changes to PR branch (default max: 1, configurable; cross-repo supported via `target-repo` when the target repository is checked out) ### Labels, Assignments & Reviews