You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
gh aw add rewrites {{#import shared/X.md}} with incorrect cross-repo path (resolves from repo root instead of .github/workflows/) #23212
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.md containing:
{{#import shared/config.md}}
The shared file exists at .github/workflows/shared/config.md in the source repo (compiles fine locally).
In a consuming repository, provide a local .github/workflows/shared/config.md with repo-specific content.
Install the workflow:
gh aw add github/source-repo/.github/workflows/my-workflow.md --force
✗ 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:
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 aw version: v0.64.2
Desired Outcome
Primary ask: Provide a way to mark body-level {{#import}} directives as "local-only" so they are not rewritten during gh 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).
Activity
pelikhan commentedon Apr 1, 2026
@copilot review this issue with the
updatefix also fix this problem.