Skip to content

compiler: auto-derive and warn on missing path: for cross-repo checkout entries#42257

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/compiler-require-path-for-checkout
Draft

compiler: auto-derive and warn on missing path: for cross-repo checkout entries#42257
Copilot wants to merge 2 commits into
mainfrom
copilot/compiler-require-path-for-checkout

Conversation

Copilot AI commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

When a checkout: block has a cross-repo entry without an explicit path:, the compiler was emitting GH_AW_CHECKOUT_PATH_N: "", causing safe-outputs handlers (e.g. push_to_pull_request_branch) to fail at runtime with "Repository not found in workspace."

Changes

  • pkg/workflow/checkout_path_validation.go — new validateCrossRepoCheckoutPaths validator that:

    • Auto-derives path: from the repo-name segment of owner/repo (e.g. githubnext/gh-aw-side-repogh-aw-side-repo) and mutates the CheckoutConfig before YAML generation, ensuring both the emitted actions/checkout step and GH_AW_CHECKOUT_PATH_N in the manifest are non-empty
    • Emits a deprecation warning directing authors to add an explicit path: to silence it
    • Skips dynamic ${{…}} expressions — cannot be resolved at compile time; common patterns like repository: ${{ github.repository }} (trusted pull_request_target checkout) must not warn
  • pkg/workflow/compiler_validators.go — wires validateCrossRepoCheckoutPaths into validateCoreToolConfiguration, before checkout step generation

# Before: missing path triggers empty GH_AW_CHECKOUT_PATH_0 → runtime failure
checkout:
  - repository: githubnext/gh-aw-side-repo
    token: ${{ secrets.TEMP_USER_PAT }}
    fetch: ["*"]
    fetch-depth: 0

# After: compiler auto-derives path and emits deprecation warning;
# explicit path: silences the warning
checkout:
  - repository: githubnext/gh-aw-side-repo
    path: gh-aw-side-repo   # ← add this
    token: ${{ secrets.TEMP_USER_PAT }}
    fetch: ["*"]
    fetch-depth: 0

…issing path

Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix compiler to require path for cross-repo checkout entries compiler: auto-derive and warn on missing path: for cross-repo checkout entries Jun 29, 2026
Copilot AI requested a review from dsyme June 29, 2026 14:34
Copilot finished work on behalf of dsyme June 29, 2026 14:34
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

Hey @dsyme 👋 — nice work scoping out the validateCrossRepoCheckoutPaths fix for cross-repo checkout entries! The task breakdown in the body is clear and the change is tightly focused on one compiler concern.

One thing to keep in mind before this moves out of WIP:

  • Ship tests with the implementation — the task list already calls this out ("Add unit tests for the new validation function"), so just make sure they land in the same PR. The new validation path (deprecation warning + auto-derive path:) has at least three meaningful cases to cover: entry with no explicit path (auto-derive fires), entry with an explicit path (no-op), and a non-cross-repo entry (should be untouched).

If you'd like a hand getting this across the finish line, here's a ready-to-use prompt:

Implement the following in the gh-aw compiler:

1. Add a `validateCrossRepoCheckoutPaths` function in `compiler_validators.go` that:
   - Iterates over all checkout entries in the workflow
   - For cross-repo entries (repo field references a different repo) that have no explicit `path:` set, auto-derives a `path:` value and emits a deprecation warning
   - Leaves entries with an explicit `path:` unchanged
   - Leaves non-cross-repo entries unchanged

2. Wire `validateCrossRepoCheckoutPaths` into `validateCoreToolConfiguration` so it runs as part of normal compilation.

3. Add unit tests in the corresponding `_test.go` file covering:
   - Cross-repo entry with no explicit path → path auto-derived, warning emitted
   - Cross-repo entry with explicit path → no change, no warning
   - Same-repo entry → no change, no warning

4. Run the full test suite and confirm all existing tests still pass.

Generated by ✅ Contribution Check · 587.8 AIC · ⌖ 18.3 AIC · ⊞ 6K ·

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Triage — §28395315609

Field Value
Category bug
Risk medium
Score 47 / 100
Action batch_review
Batch

Score breakdown: impact 25 + urgency 10 + quality 12

Compiler fix: auto-derives path: for cross-repo checkout entries missing it, fixing runtime "Repository not found in workspace" failures. 3 files (+292/-0). Draft, no CI yet. Correctly skips dynamic ${{...}} expressions. Promote from draft when ready.

Generated by 🔧 PR Triage Agent · 99.1 AIC · ⌖ 11.6 AIC · ⊞ 5.4K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants