Skip to content

docs: add reuse.md reusability guide and wire it into the agent dispatcher#29101

Merged
pelikhan merged 3 commits intomainfrom
copilot/add-imports-instruction-file
Apr 29, 2026
Merged

docs: add reuse.md reusability guide and wire it into the agent dispatcher#29101
pelikhan merged 3 commits intomainfrom
copilot/add-imports-instruction-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 29, 2026

Summary

Adds .github/aw/reuse.md, a new instruction file that explains how to reuse and refactor agentic workflows through the imports: system.

Changes

New file: .github/aw/reuse.md

Covers:

  • Why reuse? — benefits of shared components and the maintenance cost of duplication
  • Shared component file structure — which frontmatter fields are merged, minimal examples
  • The imports: field — string form and object form with with: / env: / checkout:
  • The import-schema: field — typed parameters, all supported types, accessing inputs via ${{ github.aw.import-inputs.<name> }}
  • Refactoring patterns — five concrete patterns:
    1. Extract shared tool config / MCP server
    2. Extract shared prompt instructions
    3. Parameterise with import-schema:
    4. Compose multiple imports
    5. Shared safe-output jobs
  • External imports with gh aw add and gh aw update — install, update, source: / redirect: / resources: / private: fields
  • Recommended directory layout for shared components
  • Compile-time behaviour — runtime vs inlined imports, when recompilation is required
  • Quick checklist for extracting a shared component

Updated: .github/agents/agentic-workflows.agent.md

  • Added Imports & Reusability Patterns routing bullet in the dispatcher section
  • Added Imports & Reusability Patterns ## Available Prompts entry with Load when conditions and example use cases, pointing to the new file via its canonical upstream URL

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot rename .github/aw/imports.md to .github/aw/reuse.md

Comment thread .github/aw/reuse.md Outdated
---
on:
schedule:
- cron: "0 9 * * 1" # weekly Monday 9am
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot use fuzzy schedule

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7e55bed — replaced - cron: "0 9 * * 1" with schedule: weekly on monday.

Comment thread .github/aw/reuse.md
@@ -0,0 +1,463 @@
---
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot optimize this file for agentic information density, unslop

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 29, 2026

@copilot rename .github/aw/imports.md to .github/aw/reuse.md

Done — renamed to .github/aw/reuse.md and updated the URL reference in the agent dispatcher in 897c3b1.

Copilot AI changed the title docs: add imports.md reusability guide and wire it into the agent dispatcher docs: add reuse.md reusability guide and wire it into the agent dispatcher Apr 29, 2026
Copilot AI requested a review from pelikhan April 29, 2026 12:21
@pelikhan pelikhan marked this pull request as ready for review April 29, 2026 12:45
Copilot AI review requested due to automatic review settings April 29, 2026 12:45
@pelikhan pelikhan merged commit d76d052 into main Apr 29, 2026
3 checks passed
@pelikhan pelikhan deleted the copilot/add-imports-instruction-file branch April 29, 2026 12:45
@github-actions github-actions Bot mentioned this pull request Apr 29, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.md covering 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

Comment thread .github/aw/reuse.md
Comment on lines +21 to +23
| Markdown body | Appended as prompt instructions |

All other fields (`on:`, `engine:`, `timeout-minutes:`, …) are ignored in imported files.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
| 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.

Copilot uses AI. Check for mistakes.
Comment thread .github/aw/reuse.md
Comment on lines +85 to +89
| `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> }}` |
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
| `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> }}` |

Copilot uses AI. Check for mistakes.
Comment thread .github/aw/reuse.md
Comment on lines +141 to +142
container: "mcp/jira"
version: "latest"
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
container: "mcp/jira"
version: "latest"
container: "mcp/jira:latest"

Copilot uses AI. Check for mistakes.
Comment thread .github/aw/reuse.md

## 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.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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.

Copilot uses AI. Check for mistakes.
Comment thread .github/aw/reuse.md
Comment on lines +5 to +7
# 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.
Copy link

Copilot AI Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants