Skip to content

Commit d75acd7

Browse files
Copilotpelikhan
andcommitted
Update import-workflow to import referenced custom agents
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent 48ed7e2 commit d75acd7

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/import-workflow.lock.yml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/import-workflow.md

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,26 @@ Before importing, verify the workflow does not already exist in this repository:
7070
- Check `README.md` for an existing entry
7171
- If the workflow already exists, exit with a clear message explaining the duplicate
7272

73-
## Step 3: Adapt the workflow for general use
73+
## Step 3: Check for custom agent references
74+
75+
Before adapting the workflow, check if it references any custom agents:
76+
77+
1. **Check the `engine.agent` field** in the workflow frontmatter:
78+
- If `engine.agent` is present, it references `.github/agents/{agent}.agent.md` from the source repository
79+
- Example: `agent: technical-doc-writer``.github/agents/technical-doc-writer.agent.md`
80+
81+
2. **Check the `imports` array** for `.github/agents/` references:
82+
- Imports can include paths like `.github/agents/my-agent.agent.md`
83+
- These are custom agent files that need to be imported alongside the workflow
84+
85+
3. **Fetch referenced custom agents** from the source repository:
86+
- Use `get_file_contents` to fetch each custom agent file from the source repository
87+
- Custom agent files are markdown files with frontmatter and agent instructions
88+
- Save each custom agent to `.github/agents/<agent-name>.agent.md` in this repository
89+
90+
4. **Note**: According to gh-aw documentation, only one custom agent file is allowed per workflow
91+
92+
## Step 4: Adapt the workflow for general use
7493

7594
The workflow from the source repository may contain project-specific references. Adapt it:
7695

@@ -79,10 +98,11 @@ The workflow from the source repository may contain project-specific references.
7998
- Keep the core value and behavior of the workflow intact
8099
- Preserve the frontmatter structure (triggers, permissions, safe-outputs, tools, timeout)
81100
- Add a `source:` field in the frontmatter pointing to the original workflow URL
101+
- **Preserve custom agent references** (engine.agent and imports) if they were imported
82102

83103
Save the adapted workflow to `workflows/<workflow-name>.md`.
84104

85-
## Step 4: Create the documentation page
105+
## Step 5: Create the documentation page
86106

87107
Create a new file at `docs/<workflow-name>.md` following the established documentation pattern used by other docs pages in this repository. The documentation page MUST include these sections:
88108

@@ -120,7 +140,7 @@ Create a new file at `docs/<workflow-name>.md` following the established documen
120140

121141
Study the existing docs pages (e.g., `docs/ci-doctor.md`, `docs/issue-triage.md`, `docs/plan.md`, `docs/daily-doc-updater.md`) to match the tone and style.
122142

123-
## Step 5: Update README.md
143+
## Step 6: Update README.md
124144

125145
Add the new workflow to the appropriate section in `README.md`. The existing categories are:
126146

@@ -138,18 +158,19 @@ Use the format: `- [<Emoji> <Title>](docs/<name>.md) - <Short description>`
138158

139159
If the workflow doesn't fit any existing category, create a new appropriately-named category section. Place it logically among the existing sections.
140160

141-
## Step 6: Compile the workflow
161+
## Step 7: Compile the workflow
142162

143163
Run `gh aw compile --dir workflows` to generate the `.lock.yml` file for the new workflow.
144164

145165
If `gh aw` is not installed, install it first with `gh extension install github/gh-aw`.
146166

147-
## Step 7: Create a pull request
167+
## Step 8: Create a pull request
148168

149169
Create a draft pull request with all the changes:
150170

151171
- The new workflow file in `workflows/`
152172
- The compiled `.lock.yml` file
173+
- Any imported custom agent files in `.github/agents/`
153174
- The new documentation page in `docs/`
154175
- The updated `README.md`
155176

@@ -158,6 +179,7 @@ The PR description should include:
158179
- **Source**: Link to the original workflow in the source repository
159180
- **What it does**: Brief description of the workflow's purpose
160181
- **Adaptations**: What was changed to generalize the workflow
182+
- **Custom agents**: List any custom agent files that were imported
161183
- **Category**: Which README section it was added to
162184

163185
## Important Guidelines

0 commit comments

Comments
 (0)