docs: add concrete steps/mcp-servers/jobs import examples to imports reference#23835
docs: add concrete steps/mcp-servers/jobs import examples to imports reference#23835
Conversation
…rts reference Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f0bf22fb-e4e8-4bf2-9423-5093df45fb97 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
Hey A few things to address before this is ready for review:
Here's a ready-to-use prompt to complete this:
|
| Search the web for relevant information and summarize findings in the issue. | ||
| ``` | ||
|
|
||
| ### Importing Jobs via `safe-outputs.jobs` |
There was a problem hiding this comment.
Added a "Top-level jobs:" subsection (e20ab5c) showing the super-linter pre-execution job pattern before the safe-outputs.jobs section, with a note that top-level jobs are per-workflow and cannot be imported.
…ts reference Agent-Logs-Url: https://github.com/github/gh-aw/sessions/93f24123-41f3-46ac-89c2-0f10516e690c Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot top level jobs in shared agentic workflows are imported in the final lock file and ordered according to the "needs" entries. Update sample to focus on shared agentic workflows . The custom job can be before or after the jobs using needs |
There was a problem hiding this comment.
Pull request overview
Adds concrete, copy/paste-ready examples to the imports: reference docs so readers can see how AzDo-style step templating works in practice (steps, MCP servers, and importable job-like behavior via safe-outputs.jobs).
Changes:
- Add a “Importing Steps” example showing imported steps are prepended in import declaration order
- Add an “Importing MCP Servers” example showing how to share and import an
mcp-servers:+network:block - Add guidance and examples around top-level
jobs:(non-importable) and the importable alternativesafe-outputs.jobs
Comments suppressed due to low confidence (1)
docs/src/content/docs/reference/imports.md:394
- The YAML example defines
safe-outputs: notify-slack:directly. For importable custom jobs, this should be nested assafe-outputs: { jobs: { notify-slack: ... } }so it’s recognized as a custom safe-output job (and merged according tosafe-outputs.jobs).
description: Shared notification job
safe-outputs:
notify-slack:
description: "Post a message to Slack"
runs-on: ubuntu-latest
output: "Notification sent"
inputs:
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Jobs defined under `safe-outputs:` can be shared across workflows. These jobs become callable MCP tools that the AI agent can invoke during execution: | ||
|
|
||
| ```aw title="shared/notify.md" wrap | ||
| --- | ||
| description: Shared notification job | ||
| safe-outputs: | ||
| notify-slack: | ||
| description: "Post a message to Slack" | ||
| runs-on: ubuntu-latest | ||
| output: "Notification sent" | ||
| inputs: | ||
| message: | ||
| description: "Message to post" | ||
| required: true | ||
| type: string | ||
| steps: | ||
| - name: Post to Slack | ||
| env: | ||
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
| run: | | ||
| curl -s -X POST "$SLACK_WEBHOOK" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"text\":\"${{ inputs.message }}\"}" |
There was a problem hiding this comment.
In this section the text says jobs are defined under safe-outputs:. Custom safe-output jobs are defined under safe-outputs.jobs: (see reference/custom-safe-outputs.md quick start); otherwise the workflow treats the key as a built-in safe-output type and compilation/behavior will be incorrect. Update the wording here to explicitly reference safe-outputs.jobs.
This issue also appears on line 388 of the same file.
| Jobs defined under `safe-outputs:` can be shared across workflows. These jobs become callable MCP tools that the AI agent can invoke during execution: | |
| ```aw title="shared/notify.md" wrap | |
| --- | |
| description: Shared notification job | |
| safe-outputs: | |
| notify-slack: | |
| description: "Post a message to Slack" | |
| runs-on: ubuntu-latest | |
| output: "Notification sent" | |
| inputs: | |
| message: | |
| description: "Message to post" | |
| required: true | |
| type: string | |
| steps: | |
| - name: Post to Slack | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| run: | | |
| curl -s -X POST "$SLACK_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"text\":\"${{ inputs.message }}\"}" | |
| Jobs defined under `safe-outputs.jobs:` can be shared across workflows. These jobs become callable MCP tools that the AI agent can invoke during execution: | |
| ```aw title="shared/notify.md" wrap | |
| --- | |
| description: Shared notification job | |
| safe-outputs: | |
| jobs: | |
| notify-slack: | |
| description: "Post a message to Slack" | |
| runs-on: ubuntu-latest | |
| output: "Notification sent" | |
| inputs: | |
| message: | |
| description: "Message to post" | |
| required: true | |
| type: string | |
| steps: | |
| - name: Post to Slack | |
| env: | |
| SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} | |
| run: | | |
| curl -s -X POST "$SLACK_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"text\":\"${{ inputs.message }}\"}" |
| curl -s -X POST "$SLACK_WEBHOOK" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d "{\"text\":\"${{ inputs.message }}\"}" |
There was a problem hiding this comment.
Inside a safe-outputs.jobs.<name> job, ${{ inputs.message }} is not a GitHub Actions input context. The job should read the tool call payload from $GH_AW_AGENT_OUTPUT (filtering by type with dashes normalized to underscores, e.g. notify_slack) and then construct the JSON payload with proper escaping (e.g. using jq) before calling curl.
| curl -s -X POST "$SLACK_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"text\":\"${{ inputs.message }}\"}" | |
| message="$( | |
| echo "$GH_AW_AGENT_OUTPUT" | jq -r ' | |
| .tools[] | |
| | select(.type == "notify_slack") | |
| | .payload.message | |
| ' | |
| )" | |
| payload="$(jq -n --arg text "$message" '{text: $text}')" | |
| curl -s -X POST "$SLACK_WEBHOOK" \ | |
| -H "Content-Type: application/json" \ | |
| -d "$payload" |
…th needs ordering Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7facfa39-83b7-46db-9e95-ce77a8bd17d4 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated in af9e6c0. The example now shows a |
| contents: read | ||
| issues: write | ||
| jobs: | ||
| super_linter: |
There was a problem hiding this comment.
@copilot move jobs in separate shared workflow, remove taviky from this section example
There was a problem hiding this comment.
Already done in af9e6c0 — the section now shows jobs: defined inside a separate shared/build.md file (not inline in the consuming workflow), and the Tavily import was removed from this example.
The
imports:field already supports AzDo-style step templating, but the reference docs only described merge semantics in a table without showing how to actually use it. Adds concrete examples to the Frontmatter Merging section ofimports.md.Added examples
rotate-token.mdwith a GitHub App token step; imported steps are prepended before the main workflow's own steps in declaration ordershared/mcp/tavily.mdimported into any workflow needing web searchjobs:— shows ashared/build.mdwith ajobs:entry that usesneedsto declare its position; shared jobs are merged into the importing workflow's compiled lock file and ordered byneedsdeclarations (the job can run before or after the agent job)safe-outputs.jobs— shows the callable MCP tool alternative that exposes jobs the AI agent can invoke on demandSteps import example
--- description: Shared token rotation setup steps: - name: Rotate GitHub App token id: get-token uses: actions/create-github-app-token@v1 with: app-id: ${{ vars.APP_ID }} private-key: ${{ secrets.APP_PRIVATE_KEY }} ---