-
Notifications
You must be signed in to change notification settings - Fork 316
Description
Bug Description
When installing a workflow from a remote repository via gh aw add, body-level {{#import shared/X.md}} directives are rewritten to cross-repo imports. This causes two distinct problems:
Problem 1: Unwanted rewriting of intentionally-local imports
gh aw add rewrites ALL {{#import shared/X.md}} directives to cross-repo paths pinned to the source repository (e.g., {{#import github/source-repo/shared/X.md@SHA}}). There is no way to indicate that an import should remain local — resolved from the consuming repository's own .github/workflows/shared/ directory rather than fetched from the source.
This breaks the shared workflow library pattern where a source repo publishes reusable workflows, but consuming repos provide their own local shared/ files with repo-specific or team-specific configuration.
Problem 2: Incorrect cross-repo path resolution
Even if the cross-repo rewriting were desired, the rewritten path is wrong. gh aw add resolves shared/X.md from the repository root instead of .github/workflows/shared/X.md, causing a 404.
Steps to Reproduce
-
In a source repository, create a workflow at
.github/workflows/my-workflow.mdcontaining:{{#import shared/config.md}} -
The shared file exists at
.github/workflows/shared/config.mdin the source repo (compiles fine locally). -
In a consuming repository, provide a local
.github/workflows/shared/config.mdwith repo-specific content. -
Install the workflow:
gh aw add github/source-repo/.github/workflows/my-workflow.md --force
-
The import is rewritten to:
{{#import github/source-repo/shared/config.md@abc123}} -
Compilation fails:
✗ error: failed to resolve required include 'github/source-repo/shared/config.md@abc123' HTTP 404: Not Found (https://api.github.com/repos/github/source-repo/contents/shared/config.md?ref=abc123)
Expected Behavior
{{#import shared/config.md}} should remain unchanged after gh aw add, resolving locally in the consuming repository. Not all shared imports should be pinned to the source repo — some are intentionally local.
Actual Behavior
gh aw add rewrites the import to a cross-repo path:
{{#import github/source-repo/shared/config.md@abc123}}
This is wrong in two ways:
- It pins to the source repo instead of staying local
- It resolves from the repo root (
shared/config.md) instead of.github/workflows/shared/config.md
Impact
Every gh aw add and presumably gh aw update requires a manual post-install fix to revert the rewritten imports, making the install/update cycle non-idempotent.
Environment
gh awversion: v0.64.2
Desired Outcome
-
Primary ask: Provide a way to mark body-level
{{#import}}directives as "local-only" so they are not rewritten duringgh aw add. These imports should resolve from the consuming repo's local.github/workflows/shared/directory. -
Secondary ask: If cross-repo import rewriting is kept for some cases, fix the path resolution so it uses the correct full path (
.github/workflows/shared/X.md) instead of resolving from the repo root (shared/X.md).