Summary
When using gh aw add to install a workflow from another repository, the generated source: field uses a short-form path that omits the .github/workflows/ prefix. This causes gh aw update to fail with a 404 when it tries to fetch the file from the source repo.
Steps to reproduce
- Create a shared workflow repo with a workflow at
.github/workflows/my-workflow.md
- From a consuming repo, run:
gh aw add my-org/shared-workflows/my-workflow@main
- Observe the generated
source: field in the consuming repo's .github/workflows/my-workflow.md:
source: my-org/shared-workflows/my-workflow.md@abc123def456
- Make a change in the shared repo and push
- From the consuming repo, run:
Expected behavior
gh aw update fetches the latest version and merges changes.
Actual behavior
✗ Failed to update 1 workflow(s):
my-workflow: failed to download workflow: failed to fetch file content: exit status 1
The update fails because the source: path resolves to my-org/shared-workflows/my-workflow.md at the API level, but the actual file is at .github/workflows/my-workflow.md in the repo.
Workaround
Manually update the source: field to include the full path:
# Before (generated by gh aw add)
source: my-org/shared-workflows/my-workflow.md@abc123def456
# After (fixes gh aw update)
source: my-org/shared-workflows/.github/workflows/my-workflow.md@main
Related: local vs remote import path resolution
The same short-form vs full-path issue affects {{#import}} directives in workflow bodies. When a shared workflow uses relative imports like:
{{#import shared/doc-sync/phases.md}}
This compiles fine locally because gh aw compile resolves paths relative to .github/workflows/. However, when a consuming repo adds the workflow via gh aw add, the import is expanded to a remote reference:
{{#import my-org/shared-workflows/shared/doc-sync/phases.md@abc123}}
This 404s because the GitHub API resolves from the repo root, where the actual path is .github/workflows/shared/doc-sync/phases.md.
The workaround is to use full repo-root-relative paths in the source workflow:
{{#import .github/workflows/shared/doc-sync/phases.md}}
This works for both local compile and remote resolution, but it means workflow authors need to know that gh aw add doesn't translate the short-form paths the way gh aw compile does locally.
Additional notes
gh aw compile and workflow execution are not affected by the source: issue — only gh aw update breaks
- The
{{#import}} lines in the body are correctly expanded to full paths when using the full-path workaround; only source: uses the short form regardless
- It would also be useful to have a flag (e.g.
--ref main) to pin source: to a branch instead of a commit SHA, so consuming repos can track the latest version without manual edits
Summary
When using
gh aw addto install a workflow from another repository, the generatedsource:field uses a short-form path that omits the.github/workflows/prefix. This causesgh aw updateto fail with a 404 when it tries to fetch the file from the source repo.Steps to reproduce
.github/workflows/my-workflow.mdsource:field in the consuming repo's.github/workflows/my-workflow.md:Expected behavior
gh aw updatefetches the latest version and merges changes.Actual behavior
The update fails because the
source:path resolves tomy-org/shared-workflows/my-workflow.mdat the API level, but the actual file is at.github/workflows/my-workflow.mdin the repo.Workaround
Manually update the
source:field to include the full path:Related: local vs remote import path resolution
The same short-form vs full-path issue affects
{{#import}}directives in workflow bodies. When a shared workflow uses relative imports like:{{#import shared/doc-sync/phases.md}}This compiles fine locally because
gh aw compileresolves paths relative to.github/workflows/. However, when a consuming repo adds the workflow viagh aw add, the import is expanded to a remote reference:{{#import my-org/shared-workflows/shared/doc-sync/phases.md@abc123}}This 404s because the GitHub API resolves from the repo root, where the actual path is
.github/workflows/shared/doc-sync/phases.md.The workaround is to use full repo-root-relative paths in the source workflow:
{{#import .github/workflows/shared/doc-sync/phases.md}}This works for both local compile and remote resolution, but it means workflow authors need to know that
gh aw adddoesn't translate the short-form paths the waygh aw compiledoes locally.Additional notes
gh aw compileand workflow execution are not affected by thesource:issue — onlygh aw updatebreaks{{#import}}lines in the body are correctly expanded to full paths when using the full-path workaround; onlysource:uses the short form regardless--ref main) to pinsource:to a branch instead of a commit SHA, so consuming repos can track the latest version without manual edits