github / github/gh-aw

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

Open
#42,256 1 comment 1 reaction 2 assignees Claimed by @dsyme View on GitHub
bug
Dominant language
Go
Stars
5.1k
Forks
541
Avg merge
5h 46m
Merged PRs (30d)
760

Description

## Problem

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

```yaml
# 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:

```yaml
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](https://github.com/githubnext/gh-aw-test/actions/runs/28349548237) and [28349741075](https://github.com/githubnext/gh-aw-test/actions/runs/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-repo` → `path: 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:

```yaml
# 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.