Cross-Repository Operations

Cross-repository operations let workflows access code from other repositories and create resources (issues, PRs, comments) in them. This page documents the frontmatter features for cross-repository workflows. All of them require additional authentication.

The features fall into three categories:

  1. Cross-Repository Checkout: check out code from other repositories
  2. Cross-Repository Reading: read issues, pull requests, and other information from other repositories
  3. Cross-Repository Safe Outputs: create resources in external repositories using target-repo and allowed-repos

The checkout: field controls how actions/checkout runs in the agent job. Use it to check out one or more repositories, override fetch depth or sparse-checkout settings, fetch extra refs (for example, all open PR branches), or disable checkout with checkout: false.

List multiple entries to clone several repositories into the workspace. Mark the agent’s primary target with current: true when working from a central repository that targets a different repo. For sidecar workflows that need only a target repository, set permissions.contents: none to skip the workflow-repository checkout; other checkout: entries still apply. See Target-Only Checkout.

When current: true points to a subdirectory checkout, PR patch generation for create-pull-request and push-to-pull-request-branch runs from that path (when targeting that repository). This keeps PR patches focused on real file changes instead of workspace-root gitlinks or subproject entries.

checkout:
- fetch-depth: 0 # checkout this repository with full history
fetch: ["refs/pulls/open/*"] # fetch all open PR branches after checkout
- repository: owner/other-repo # another repository to check out
path: ./libs/other # path within workspace to check out to
github-token: ${{ secrets.CROSS_REPO_PAT }} # additional auth for cross-repo access

See GitHub Repository Checkout for the full reference, including fetch options, sparse checkout, and merging rules.

The GitHub Tools read issues, pull requests, and other information. By default, they can access the current repository and all public repositories (if the network firewall permits).

Authorizing Additional Cross-Repository Reading

Section titled “Authorizing Additional Cross-Repository Reading”

To read private repositories, configure a PAT or GitHub App in the GitHub Tools configuration:

tools:
github:
toolsets: [repos, issues, pull_requests]
github-token: ${{ secrets.CROSS_REPO_PAT }}

This enables reading files and searching code in external repositories (even when not checked out), querying issues and pull requests, accessing commits, releases, and workflow runs, and reading organization-level information.

See Additional Authentication for GitHub Tools for creating a PAT, using a GitHub App, or the magic secret GH_AW_GITHUB_MCP_SERVER_TOKEN. For full PAT and GitHub App setup, see the Authentication Reference.

Restricting Cross-Repository Reading (tools.github.allowed-repos)

Section titled “Restricting Cross-Repository Reading (tools.github.allowed-repos)”

tools.github.allowed-repos is a guardrail that limits which repositories the agent can reach through GitHub tools during engine execution. It accepts:

  • "all": all repositories accessible by the configured token
  • "public": public repositories only
  • "current": the workflow’s repository (normalized to ${{ github.repository }} in the emitted guard policy)
  • "${{ github.repository }}": equivalent to "current", kept for backward compatibility
  • An array of patterns:
    • "owner/repo": exact match
    • "owner/*": all repositories under an owner
    • "owner/prefix*": repositories with a name prefix under an owner

It defaults to "all". Patterns must be lowercase, and wildcards are allowed only at the end of the repository name.

Use current in reusable or generated workflows that need “this repository only” without hard-coding owner/repo:

tools:
github:
toolsets: [issues, pull_requests]
allowed-repos: current
min-integrity: approved

Or list specific repositories and wildcards:

tools:
github:
mode: remote
toolsets: [default]
allowed-repos:
- "myorg/*"
- "partner/shared-repo"
- "myorg/api-*"
min-integrity: approved

Most safe output types can create resources in external repositories through target-repo and allowed-repos.

Target Repository (safe-outputs.*.target-repo)

Section titled “Target Repository (safe-outputs.*.target-repo)”

Specify a single target repository:

safe-outputs:
github-token: ${{ secrets.CROSS_REPO_PAT }}
create-issue:
target-repo: "org/tracking-repo"
title-prefix: "[component] "

Without target-repo, safe outputs operate on the workflow’s repository.

Wildcard Target Repository (target-repo: "*")

Section titled “Wildcard Target Repository (target-repo: "*")”

Set target-repo: "*" to let the agent choose any repository at runtime. The agent then supplies a repo parameter in owner/repo format on each tool call. Use this when the target isn’t known at authoring time, such as when routing issues to different repositories based on labels or content.

safe-outputs:
github-token: ${{ secrets.CROSS_REPO_PAT }}
create-issue:
target-repo: "*"
title-prefix: "[component] "

Allowed Repositories (safe-outputs.*.allowed-repos)

Section titled “Allowed Repositories (safe-outputs.*.allowed-repos)”

Let the workflow select from several repositories:

safe-outputs:
github-token: ${{ secrets.CROSS_REPO_PAT }}
create-issue:
target-repo: "org/default-repo"
allowed-repos: ["org/repo-a", "org/repo-b", "org/repo-c"]
title-prefix: "[cross-repo] "

When allowed-repos is set:

  • The agentic step can include a repo field to select the destination
  • The target repository (from target-repo or the current repo) is always implicitly allowed
  • The result is the union of allowed destinations

Checkout Requirement for Pull Request Outputs

Section titled “Checkout Requirement for Pull Request Outputs”

Unlike other safe output types, create-pull-request and push-to-pull-request-branch with a cross-repository target require the target repository to be checked out into the workflow workspace. This also applies when the target is resolved from GH_AW_TARGET_REPO_SLUG. Use a checkout: entry with a path:, or a custom steps: entry that clones the repository under $GITHUB_WORKSPACE. Without a target checkout, these handlers return an error instead of generating a patch from the workflow repository.

Safe outputs first consult the checkout manifest from checkout: entries, then scan $GITHUB_WORKSPACE for git repositories and match them by remote.origin.url.

Commit changes in the target checkout against the intended base branch. Copying a file read through GitHub tools into the workflow repository doesn’t establish that base: Git treats the copy as a new file even if it exists in the target, and git am --3way can’t turn that new-file patch into a modification without an original target blob.

See the Scheduled Push to Pull Request Branch example and the push to PR branch cross-repo usage docs for a complete setup.

This uses multiple checkout: entries to check out the current repository and two others, each with different settings:

---
on:
pull_request:
types: [opened, synchronize]
checkout:
- fetch-depth: 0
- repository: org/shared-libs
path: ./libs/shared
ref: main
github-token: ${{ secrets.LIBS_PAT }}
- repository: org/config-repo
path: ./config
sparse-checkout: |
defaults/
overrides/
permissions:
contents: read
pull-requests: read
---
# Cross-Repo PR Analysis
Analyze this PR considering shared library compatibility and configuration standards.
Check compatibility with shared libraries in `./libs/shared` and verify configuration against standards in `./config`.

Example: Hub-and-Spoke and Cross-Repository Analysis

Section titled “Example: Hub-and-Spoke and Cross-Repository Analysis”

Use target-repo on create-issue to file issues in a central tracking repo when issues open in component repos. To read from several repositories, use tools.github with github-token, then write results back with add-comment and target-repo. For complete walkthroughs of hub-and-spoke, upstream-to-downstream, and org-wide broadcast topologies, see MultiRepoOps and the multi-repository gallery.

Example: Deterministic Multi-Repo Workflows

Section titled “Example: Deterministic Multi-Repo Workflows”

For direct repository access without agent involvement, use custom steps with actions/checkout:

---
engine:
id: claude
steps:
- name: Checkout main repo
uses: actions/checkout@v7
with:
path: main-repo
- name: Checkout secondary repo
uses: actions/checkout@v7
with:
repository: org/secondary-repo
token: ${{ secrets.CROSS_REPO_PAT }}
path: secondary-repo
permissions:
contents: read
---
# Compare Repositories
Compare code structure between main-repo and secondary-repo.

This gives full control over checkout timing and configuration.

Example: Scheduled Push to Pull Request Branch

Section titled “Example: Scheduled Push to Pull Request Branch”

A scheduled workflow that pushes changes to open pull-request branches in another repository must fetch those branches after checkout. Without fetch:, only the default branch (usually main) is available.

---
on:
schedule: hourly
checkout:
- repository: org/target-repo
github-token: ${{ secrets.GH_AW_SIDE_REPO_PAT }}
fetch: ["refs/pulls/open/*"] # fetch all open PR branches after checkout
current: true
permissions:
contents: read
safe-outputs:
github-token: ${{ secrets.GH_AW_SIDE_REPO_PAT }}
push-to-pull-request-branch:
target-repo: "org/target-repo"
---
# Auto-Update PR Branches
Check open pull requests in org/target-repo and apply any pending automated
updates to each PR branch.

fetch: ["refs/pulls/open/*"] runs a git fetch after actions/checkout, downloading all open PR head refs into the workspace. The agent can then inspect and modify those branches directly.