-
Notifications
You must be signed in to change notification settings - Fork 46
Implement agent and repository imports with runtime .github folder merging #12771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot the compiler must add a step so that the contents of the imported repo .github folder need to be merge in the current .github. If there is any file clash, fail. This must happen at runtime in the action. Use sparse checkout to a temp foldeer, copy file by file. |
Implements sparse checkout-based .github folder merging when agent files are imported from remote repositories. This ensures all agent-related files from the remote repo are available at runtime. - Add merge_remote_agent_github_folder.cjs script for runtime merging - Track AgentImportSpec in ImportsResult and WorkflowData - Add merge step after checkout in generated workflows - Use sparse checkout for efficiency (only downloads .github folder) - Fail on file conflicts to prevent silent overwrites - Set GH_AW_AGENT_FILE and GH_AW_AGENT_IMPORT_SPEC environment variables Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented runtime .github folder merging for remote agent imports in commit a086fd3. The solution:
The merge step is added to the workflow with environment variables:
Example generated workflow step: - name: Merge remote agent .github folder
uses: actions/github-script@...
env:
GH_AW_AGENT_FILE: ".github/agents/code-reviewer.md"
GH_AW_AGENT_IMPORT_SPEC: "acme-org/ai-agents/.github/agents/code-reviewer.md@v1.0.0"
with:
script: |
const script = require('./actions/setup/js/merge_remote_agent_github_folder.cjs');
return script.main(); |
|
@copilot update scout to import the github deep research agent and invoke it the prompt. |
|
@copilot we want to be able to import the repo url. In that case, we import the entire .github folder only (shallow) but do not extract the agent. |
The
Could you clarify:
The scout workflow is already set up for deep research with Tavily, arXiv, DeepWiki, and Microsoft Docs MCPs. With the agent import feature we just implemented, we can add an agent import once we know the correct repository and path. |
Add ability to import entire repositories (owner/repo@ref format) which merges only the .github folder at runtime without extracting agent files. - Add isRepositoryImport() to detect owner/repo@ref format imports - Track RepositoryImports in ImportsResult and WorkflowData - Update merge script to handle GH_AW_REPOSITORY_IMPORTS environment variable - Generate merge step with JSON array of repository imports - Support multiple repository imports in a single workflow Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Implemented repository-only imports in commit a1f86ad. Now you can import entire repositories using just imports:
- github/github-deep-research-agent@main # Merges .github folder, no agent extractionThe system automatically:
This is separate from agent file imports ( |
- Add github/github-deep-research-agent@main repository import - Update prompt to reference deep research agent tools - Improve repository import detection to exclude local paths (shared/) - Validate file extensions to prevent false positives The scout workflow now imports the entire .github folder from the deep research agent repository, making all its tools and agents available at runtime. Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Use /opt/gh-aw/actions/ path for runtime script loading
- Remove require('@actions/core'), use global core object from github-script
- Add setupGlobals() call for consistency with other github-script steps
- Update comment to avoid test regex false positive
- All tests now pass (TestCJSFilesNoActionsRequires, TestLockFilesHaveNoBundledRequires)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent files and entire repositories can be imported from external repositories using the
owner/repo/path@reforowner/repo@refformats. When imported, the entire.githubfolder from the remote repository is automatically merged at runtime.Two Import Modes
1. Repository Import (
owner/repo@ref) - NEWImports entire
.githubfolder without agent extraction:Use case: Import supporting files, tools, workflows from a repository without using an agent.
2. Agent File Import (
owner/repo/.github/agents/agent.md@ref)Imports specific agent file and merges
.githubfolder:Use case: Use a specific agent with all its supporting files.
Changes
Documentation (4 new/updated files)
docs/src/content/docs/examples/agent-imports.md) - Complete walkthrough with practical examples, versioning strategies, and best practicesdocs/src/content/docs/reference/imports.md) - Agent files section covering local vs remote imports, caching behaviordocs/src/content/docs/reference/custom-agents.md) - Remote import examples and versioningdocs/src/content/docs/guides/packaging-imports.md) - Agent import section with team collaboration patternsRuntime .github Folder Merging (7 code files)
When an agent or repository is imported from a remote repository, the compiler automatically adds a merge step that:
.githubfolder from the remote repository.githubto the current repository's.githubfolderImplementation:
actions/setup/js/merge_remote_agent_github_folder.cjs- JavaScript script that performs the sparse checkout and mergepkg/parser/import_processor.go- Track repository imports and agent import specspkg/parser/remote_fetch.go- Detect repository-only imports (owner/repo@ref)pkg/workflow/compiler_types.go- AddRepositoryImportsandAgentImportSpecfieldspkg/workflow/compiler_orchestrator_workflow.go- Pass import data through compilationpkg/workflow/compiler_yaml_main_job.go- Generate merge step after checkout in workflows.github/workflows/scout.md- Updated to importgithub/github-deep-research-agent@mainUsage Examples
Repository Import (NEW)
Import entire .github folder without using an agent:
Agent Import
Import specific agent file and merge .github folder:
Multiple Repository Imports
How It Works
Repository Import (
owner/repo@ref):RepositoryImportslist.github/folder and merges it into workspaceAgent Import (
owner/repo/.github/agents/agent.md@ref):.github/folder and merges itBoth modes:
Detection Logic
The system automatically detects import type:
owner/repo), no file extensionshared/,.github/,., or/are treated as localScout Workflow Update
Scout now imports the deep research agent repository:
Generated merge step:
Organizations can maintain agent libraries with supporting files:
Documentation
Agent Imports Example:

Imports Reference:

Custom Agents Reference:

Remote agents are cached in
.github/aw/imports/by commit SHA for offline compilation. Only one agent file (local or remote) can be imported per workflow.Test Results
✅ All parser tests pass
✅
TestCJSFilesNoActionsRequirespasses✅
TestLockFilesHaveNoBundledRequirespasses✅ Scout workflow compiles successfully (78.3 KB)
✅ Build and format successful
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.