feat: implement imports feature for workflow dependencies#1153
feat: implement imports feature for workflow dependencies#1153
Conversation
- Add ImportSpec and lock file structures - Implement parsing for import specifications (org/repo version path) - Add import lock file read/write functionality - Create InstallImports command to resolve and clone imports - Integrate import processing into compile workflow - Add 'gh aw install' CLI command for installing imports - Update .gitignore to exclude .aw directory Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Add imports field to main_workflow_schema.json - Use git ls-remote instead of gh API for version resolution - Add better error handling and verbose output - Successfully tested end-to-end workflow with imports Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot the imported files should be .gitignored, only the .sum file is to be commited. |
- Change .gitignore from .aw/ to .aw/imports/ - This allows .aw/imports.lock to be committed - Update documentation to reflect this change - Matches Go's approach where go.sum is committed but modules are not Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Fixed in commit 21a9f06. Changed |
|
@copilot the install command should generate a .gitignore file in the .aw folder that ignores the "imports" folder |
- Install command now creates .aw/.gitignore automatically - This ensures imports/ folder is ignored even without root .gitignore - Prevents accidental commits of cached imported files - Updates documentation to reflect this automatic behavior Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
|
||
| ## Installation | ||
|
|
||
| Before compiling workflows with imports, install the dependencies: |
There was a problem hiding this comment.
Adding a step before compiling feels wrong. We're already 1-step when we need to be 0-step. We don't want to be 2-step
Why isn't this part of compiling?
|
|
||
| ## Lock File | ||
|
|
||
| The install command generates `.aw/imports.lock` which records: |
There was a problem hiding this comment.
Another lock is too complex isn't it? Lock on lock...
There was a problem hiding this comment.
Yup can be merged in the generated lock.yml file
| issues: write | ||
| engine: claude | ||
| imports: | ||
| - githubnext/gh-aw main .github/workflows/agentics/shared/tool-refused.md |
There was a problem hiding this comment.
In GitHub Actions uses the syntax is simpler, like this:
githubnext/gh-aw/.github/workflows/agentics/shared/tool-refused.md@main
e.g.
steps:
- name: Start the Repo-mind MCP server
id: repo-mind-server
uses: githubnext/repo-mind/.github/actions/server@main
We should align with this I think
| - **path**: Relative path to the file within the repository | ||
|
|
||
| Examples: | ||
| - `microsoft/genaiscript v1.5.0 agentics/engine.md` - Import from a specific version tag |
There was a problem hiding this comment.
See comment below, let's use
microsoft/genaiscript/agentics/engine.md@v1.5.0- Import from a specific version tag
|
I get the ideas. But this doesn't yet feel quite right to me - I guess one litmus test is I don't think I'd use it, nor would people authoring new workflows. Let's put aside whether we use "@include" in markdown or "imports:" in frontmatter and assume they are equivalent? (soif we add the latter we should make sure they're equivalent and use the same name). I prefer "@include" or at least don't really prefer one over the other. But let's just stay neutral on that for a bit and call these "includes"/"imports" either way. I think we're aligned on the idea of "includes"/"imports" being useful in general. I think the problem from an authoring perspective is that the items being shared across repo aren't significant enough to warrant manually authoring a cross-repo reference (plus the extra lock step etc). We have very few workflows where the frontmatter is more than a few lines, and very few workflows where there is that much sharing in the markdown. But now I'm wondering if the main idea that "gh aw add some-remote-workflow-spec" would add the "import" data and would only install one file. We do definitely have problems with the current "xcopy" approach. Are you proposing that only the With that "include"/"import" dependencies potentially conflicting and also have no "gh aw update" path. Also the current "gh aw install" isn't what we what and we should rip that out. I'm trying to think through what end-user experience of versioning I want. I think my priority would be "gh aw add owner/repo/workflows/some-workflow.md@tag" + "gh aw update" do the right thing under external change. That would mean keeping the SHA of the resolved workflow in the installed .md via an injected |
|
We cannot support all agentic engines so they should be able to define a workflow.md included so that it integrate in aw. Those will be non-trivial, and versioned. |
Implementation Complete: Imports Feature ✅
Summary
Successfully implemented the imports feature for GitHub Agentic Workflows as specified in the issue. The implementation allows workflows to import content from external GitHub repositories similar to Go's module system.
All Tasks Completed ✅
importsfield to frontmatter schemaImportSpecstruct to represent an import (repo, version, path)importsarray in frontmatter.aw/importsdirectory.aw/.gitignoreduring installImplementation Statistics
Key Features
Import Syntax:
CLI Commands:
gh aw install- Install all imports from workflowsgh aw install <workflow>- Install imports for specific workflowgh aw compile- Compile workflows (requires install first)Lock File:
.aw/imports.locktracks resolved SHAs (committed to git)Cached Files:
.aw/imports/contains downloaded files (ignored by git)Auto .gitignore: Install command automatically creates
.aw/.gitignoreFrontmatter Merging: Tools and configs merged automatically
No Authentication Required: Uses git ls-remote (public repos)
Version Control
Following Go's approach with automatic .gitignore generation:
.aw/imports.lockis committed (likego.sum).aw/.gitignoreis auto-generated by install command to ignoreimports/folder.aw/imports/is ignored (likenode_modulesor Go module cache)This ensures reproducible builds while keeping the repository clean, even if users forget to configure their root
.gitignore.Test Results ✅
Usage Example
Documentation Added
Created
docs/src/content/docs/reference/imports.mdwith:Future Enhancements (Not Required)
gh aw updatecommand to update imports to latest versionsNotes
installcommand now handles workflow importsinstall-package.aw/.gitignoreto prevent accidental commitsOriginal prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.