You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/imports.md
+175Lines changed: 175 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -271,6 +271,181 @@ Example — `tools.bash.allowed` merging:
271
271
# result: [read, list, write]
272
272
```
273
273
274
+
### Importing Steps
275
+
276
+
Share reusable pre-execution steps — such as token rotation, environment setup, or gate checks — across multiple workflows by defining them in a shared file:
277
+
278
+
```aw title="shared/rotate-token.md" wrap
279
+
---
280
+
description: Shared token rotation setup
281
+
steps:
282
+
- name: Rotate GitHub App token
283
+
id: get-token
284
+
uses: actions/create-github-app-token@v1
285
+
with:
286
+
app-id: ${{ vars.APP_ID }}
287
+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
288
+
---
289
+
```
290
+
291
+
Any workflow that imports this file gets the rotation step prepended before its own steps:
292
+
293
+
```aw title="my-workflow.md" wrap
294
+
---
295
+
on: issues
296
+
engine: copilot
297
+
imports:
298
+
- shared/rotate-token.md
299
+
permissions:
300
+
contents: read
301
+
issues: write
302
+
steps:
303
+
- name: Prepare context
304
+
run: echo "context ready"
305
+
---
306
+
307
+
# My Workflow
308
+
309
+
Process the issue using the rotated token from the imported step.
310
+
```
311
+
312
+
Steps from imports run **before** steps defined in the main workflow, in import declaration order.
313
+
314
+
### Importing MCP Servers
315
+
316
+
Define an MCP server configuration once and import it wherever needed:
Import it into any workflow that needs web search:
332
+
333
+
```aw title="research.md" wrap
334
+
---
335
+
on: issues
336
+
engine: copilot
337
+
imports:
338
+
- shared/mcp/tavily.md
339
+
permissions:
340
+
contents: read
341
+
issues: write
342
+
---
343
+
344
+
# Research Workflow
345
+
346
+
Search the web for relevant information and summarize findings in the issue.
347
+
```
348
+
349
+
### Importing Top-level `jobs:`
350
+
351
+
Top-level `jobs:` defined in a shared workflow are merged into the importing workflow's compiled lock file. The job execution order is determined by `needs` entries — a shared job can run before or after other jobs in the final workflow:
352
+
353
+
```aw title="shared/build.md" wrap
354
+
---
355
+
description: Shared build job that compiles artifacts for the agent to inspect
0 commit comments