Skip to content

docs: add workflow_run trigger examples for DevOps monitoring workflows - #29060

Closed
gh-aw-bot with Copilot wants to merge 3 commits into
mainfrom
copilot/add-workflow-run-examples
Closed

docs: add workflow_run trigger examples for DevOps monitoring workflows#29060
gh-aw-bot with Copilot wants to merge 3 commits into
mainfrom
copilot/add-workflow-run-examples

Conversation

CopilotAI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

workflow_run was mentioned 4 times in create-agentic-workflow.md with no complete examples, leaving DevOps monitoring scenarios (CI/CD failure detection, deployment alerting) poorly served.

Changes

  • New section: "Creating Monitoring Workflows" — added after "Creating Command Workflows" to sit alongside other trigger pattern docs
    • deployment_status vs workflow_run distinction callout
    • Context variables reference table (conclusion, id, html_url, head_branch, head_commit.message)
    • Example 1 — minimal workflow_run + if: conclusion == 'failure' that posts a PR comment; no pre-steps
    • Example 2 — full DevOps pattern: monitors multiple workflows, pre-fetches --log-failed logs, uses cache-memory for run deduplication, and instructs the agent to post a root-cause comment
    • When-to-use checklist and agent guidance for routing monitoring requests to this pattern

Example 2 frontmatter shape:

on:
workflow_run:
workflows: ["CI", "Deploy"]types: [completed]if: ${{ github.event.workflow_run.conclusion == 'failure' }}permissions:
contents: readactions: read # required to download workflow run logstools:
github:
toolsets: [default]cache-memory: true # deduplication: skip already-diagnosed run IDssteps:
- name: Fetch failed run logsenv:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}RUN_ID: ${{ github.event.workflow_run.id }}run: | gh run view "$RUN_ID" --log-failed > /tmp/gh-aw/agent/ci-logs.txt 2>&1 || true tail -500 /tmp/gh-aw/agent/ci-logs.txt > /tmp/gh-aw/agent/ci-logs-trimmed.txtsafe-outputs:
add-comment:
max: 1

CopilotAIand others added 2 commits April 29, 2026 06:30
Add a new "Creating Monitoring Workflows" section to .github/aw/create-agentic-workflow.md
placed after "Creating Command Workflows". The section includes:
- Intro explaining workflow_run for GitHub Actions-internal monitoring
- Clarification on deployment_status vs workflow_run distinction
- Key context variables table (conclusion, name, id, html_url, head_branch, commit message)
- Example 1: minimal CI failure notification (no pre-steps)
- Example 2: full DevOps monitoring with log fetching, root-cause analysis, and dedup
- Guidance for when to use workflow_run vs deployment_status
- Agent guidance for responding to DevOps monitoring requests
Closes #<issue>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/71971270-4764-4836-beee-b7c0d1e6e7bd
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
CopilotAI changed the title [WIP] Add workflow_run trigger examples to create-agentic-workflow.mddocs: add workflow_run trigger examples for DevOps monitoring workflowsApr 29, 2026
CopilotAI requested a review from gh-aw-botApril 29, 2026 06:33
CopilotAI added a commit that referenced this pull request Apr 29, 2026
- Compile on.workflow_run.conclusion (string|string[]) into a job if
condition that guards conclusion matching, guarded by event_name check
so the condition remains transparent for other triggers (e.g. workflow_dispatch)
- Comment out the conclusion field in the YAML on: section with explanatory
comment, tracking inWorkflowRunConclusionArray to avoid false matches on
workflows:/types: array items
- Add workflow_run_conclusion to aw_context passed to workflow_call so
called workflows can access the triggering run's conclusion
- Add gh-aw.workflow_run.conclusion OTEL attribute to setup and conclusion
spans in send_otlp_span.cjs, reading from awInfo or aw_context propagation
- Add workflow_run_conclusion to generate_aw_info.cjs for direct event access
- Add "Creating Monitoring Workflows" section to create-agentic-workflow.md
(from PR #29060), updated to use on.workflow_run.conclusion instead of
manual if: condition
- Add unit tests: TestExtractWorkflowRunConclusionCondition,
TestExtractIfConditionMergesWorkflowRunConclusion,
TestWorkflowRunConclusionCommentedInYAML
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/7cab4a8f-bc7a-47f5-9cc5-79d5593830fb
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@github-actions
github-actionsBot deleted the copilot/add-workflow-run-examples branch May 7, 2026 03:00
Sign up for freeto 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.

[plan] Add workflow_run trigger examples to create-agentic-workflow.md

3 participants

@pelikhan@gh-aw-bot