docs: add reuse.md reusability guide and wire it into the agent dispatcher#29101
docs: add reuse.md reusability guide and wire it into the agent dispatcher#29101
Conversation
…patcher Agent-Logs-Url: https://github.com/github/gh-aw/sessions/215c285c-56e2-4e38-9657-acfd667a3dd4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot rename .github/aw/imports.md to .github/aw/reuse.md |
| @@ -0,0 +1,463 @@ | |||
| --- | |||
There was a problem hiding this comment.
@copilot optimize this file for agentic information density, unslop
There was a problem hiding this comment.
Done in 7e55bed — rewrote the file for agentic information density: collapsed the merged-fields table into one compact table, removed wordy intro/explanation prose before each pattern, stripped the separate "Minimal shared component" / "Mixed frontmatter" examples into the pattern code blocks, and tightened all section headers. File went from 464 → 298 lines while retaining all technical content.
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0608cd5a-6862-440e-a045-5ce43a7d7257 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…hedule Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d5314b3a-3d6d-456a-b5bf-2ebed847430a Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new reusability guide for GitHub Agentic Workflows, documenting how to factor shared components via imports: and parameterize them with import-schema:.
Changes:
- Added
.github/aw/reuse.mdcovering import merge behavior,imports:forms,import-schema:usage, refactoring patterns, and external import workflows (gh aw add/gh aw update).
Show a summary per file
| File | Description |
|---|---|
| .github/aw/reuse.md | New guide explaining reuse via imports, schema-driven parameters, and external import management. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 5
| | Markdown body | Appended as prompt instructions | | ||
|
|
||
| All other fields (`on:`, `engine:`, `timeout-minutes:`, …) are ignored in imported files. |
There was a problem hiding this comment.
The “All other fields … are ignored in imported files” line is inaccurate/incomplete: imported files can also merge checkout: (appended; main workflow takes precedence) per the main docs. Please add checkout: to the merged-fields list and avoid implying it’s ignored for imports.
| | Markdown body | Appended as prompt instructions | | |
| All other fields (`on:`, `engine:`, `timeout-minutes:`, …) are ignored in imported files. | |
| | `checkout:` | Appended; main workflow takes precedence | | |
| | Markdown body | Appended as prompt instructions | | |
| Other non-merged fields such as `on:`, `engine:`, and `timeout-minutes:` are ignored in imported files. |
| | `number` | Integer or float | | ||
| | `boolean` | `true` / `false` | | ||
| | `choice` | Enumerated; must supply `options:` | | ||
| | `array` | List of values | | ||
| | `object` | Sub-fields via `${{ github.aw.import-inputs.<name>.<subkey> }}` | |
There was a problem hiding this comment.
This “Input types” table looks incomplete vs existing shared components and the compiler: import-schema supports object with optional properties: (one-level deep) and the repo already uses type: integer (e.g. .github/workflows/shared/repo-memory-standard.md). Please document integer (or recommend number and call out integer as accepted) and mention properties: for object schemas.
| | `number` | Integer or float | | |
| | `boolean` | `true` / `false` | | |
| | `choice` | Enumerated; must supply `options:` | | |
| | `array` | List of values | | |
| | `object` | Sub-fields via `${{ github.aw.import-inputs.<name>.<subkey> }}` | | |
| | `number` | Numeric value; use for integer or float inputs | | |
| | `integer` | Accepted for whole-number inputs | | |
| | `boolean` | `true` / `false` | | |
| | `choice` | Enumerated; must supply `options:` | | |
| | `array` | List of values | | |
| | `object` | Supports optional `properties:` schema definitions (one level deep); sub-fields are accessed via `${{ github.aw.import-inputs.<name>.<subkey> }}` | |
| container: "mcp/jira" | ||
| version: "latest" |
There was a problem hiding this comment.
In this MCP server example, version: is not a supported mcp-servers.* key (container image tags should be part of the container: string, e.g. mcp/jira:latest). As written, this snippet won’t do what the guide implies for users who copy/paste it.
| container: "mcp/jira" | |
| version: "latest" | |
| container: "mcp/jira:latest" |
|
|
||
| ## Compile-Time Behaviour | ||
|
|
||
| - Imports are resolved at **compile time**; the `.lock.yml` loads shared `.md` bodies at **runtime** — edits to shared files take effect on the next run without recompilation. |
There was a problem hiding this comment.
The compile-time section currently implies that changes to imported shared files take effect without recompilation, but that’s only true for the imported Markdown body when using runtime imports. Changes to an imported file’s frontmatter (tools, safe-outputs, mcp-servers, etc.) require recompiling the consumer workflow so the merged config in the .lock.yml is updated.
| - Imports are resolved at **compile time**; the `.lock.yml` loads shared `.md` bodies at **runtime** — edits to shared files take effect on the next run without recompilation. | |
| - Imports are resolved at **compile time**; however, for non-inlined imports the `.lock.yml` loads imported shared `.md` **bodies** at **runtime**. As a result, edits to the imported Markdown body take effect on the next run without recompilation. | |
| - Changes to an imported file’s **frontmatter** (for example `tools:`, `mcp-servers:`, `safe-outputs:`, `env:`, `permissions:`, or other merged fields) **do** require recompilation so the merged config in the consumer’s `.lock.yml` is updated. |
| # Imports & Reusability | ||
|
|
||
| Shared components eliminate duplication of tool configs, prompt instructions, MCP servers, and safe-output jobs across multiple workflows. Each consumer gets updates automatically when the shared file changes. |
There was a problem hiding this comment.
PR description says .github/agents/agentic-workflows.agent.md was updated to route to an “Imports & Reusability Patterns” prompt, but that change doesn’t appear in this PR’s current file changes. Either include the dispatcher update, or adjust the PR description to match what’s actually being shipped.
Summary
Adds
.github/aw/reuse.md, a new instruction file that explains how to reuse and refactor agentic workflows through theimports:system.Changes
New file:
.github/aw/reuse.mdCovers:
imports:field — string form and object form withwith:/env:/checkout:import-schema:field — typed parameters, all supported types, accessing inputs via${{ github.aw.import-inputs.<name> }}import-schema:gh aw addandgh aw update— install, update,source:/redirect:/resources:/private:fieldsUpdated:
.github/agents/agentic-workflows.agent.md## Available Promptsentry withLoad whenconditions and example use cases, pointing to the new file via its canonical upstream URL