Skip to content

compiler: require (or auto-generate) path: for cross-repo checkout: entries #42256

Description

@dsyme

Problem

When a workflow's checkout: block contains a cross-repository entry (i.e., repository: differs from the host repo) without an explicit path::

# Source .md — missing path:
checkout:
  - repository: githubnext/gh-aw-side-repo
    token: ${{ secrets.TEMP_USER_PAT || secrets.GH_AW_TEST_PAT }}
    fetch: ["*"]
    fetch-depth: 0
    # ← no path: declared

the compiler emits the checkout manifest env var as empty:

GH_AW_CHECKOUT_PATH_0: ""   # ← empty; push handler cannot locate the repo on disk

Any safe-output handler that needs to find the side repo on disk (e.g. push_to_pull_request_branch) reads this manifest, gets an empty path, and fails:

Repository 'githubnext/gh-aw-side-repo' not found in workspace.
Check out the target repo with actions/checkout and set its 'path' input
so the checkout can be located. If checking out multiple repositories,
ensure each actions/checkout step uses the appropriate 'path' input.

This is the active blocker for test-copilot-siderepo-push-to-pull-request-branch-using-dispatch and test-copilot-siderepo-sparse-push-to-pull-request-branch-using-dispatch (tracked in #41292, runs 28349548237 and 28349741075, gh-aw commit d6d91600fd9a).

Proposed fix

Option A — auto-derive path:: When the checkout: entry has no explicit path:, the compiler derives one automatically (e.g. the repo-name portion of owner/repo, so githubnext/gh-aw-side-repopath: gh-aw-side-repo). This is the least-friction option and mirrors what actions/checkout itself recommends when checking out multiple repos.

Option B — require path: at compile time: If no path: is declared on a cross-repo checkout entry, the compiler emits a validation error/warning instructing the author to add one. This is stricter but makes the intent explicit.

Either way, GH_AW_CHECKOUT_PATH_N in the checkout manifest must be set to the resolved path.

Workaround (applied in githubnext/gh-aw-test)

Adding path: gh-aw-side-repo to the checkout: block in the source .md file fixes the issue:

# Source .md — with path: added
checkout:
  - repository: githubnext/gh-aw-side-repo
    token: ${{ secrets.TEMP_USER_PAT || secrets.GH_AW_TEST_PAT }}
    path: gh-aw-side-repo        # ← added
    fetch: ["*"]
    fetch-depth: 0

After recompiling, the compiler correctly emits GH_AW_CHECKOUT_PATH_0: "gh-aw-side-repo" and the push handler resolves the repo on disk.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions