feat: add on.workflow_run.conclusion filter support#29089
Conversation
- 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>
…span.cjs 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>
| Run details: | ||
| - **Run ID**: ${{ github.event.workflow_run.id }} | ||
| - **Conclusion**: ${{ github.event.workflow_run.conclusion }} | ||
| - **Link**: ${{ github.event.workflow_run.html_url }} |
There was a problem hiding this comment.
@copilot the run details are always automatically included
There was a problem hiding this comment.
Removed the "Run details" block from the example prompt — those details are already available to the agent automatically. (9d509a5)
| - `slash_command` full reference: https://github.github.com/gh-aw/reference/command-triggers/ | ||
| - `label_command` and LabelOps: https://github.github.com/gh-aw/patterns/label-ops/ | ||
|
|
||
| ## Creating Monitoring Workflows |
There was a problem hiding this comment.
@copilot unbloat the guidance in this file, keep minimal changes
There was a problem hiding this comment.
Trimmed the section to a single minimal example with just the conclusion filter syntax and valid values. Removed the context table, Example 2, when-to-use checklist, and guiding-the-user paragraph. (9d509a5)
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d44e3d10-c31e-447e-a910-a3dbaf10f21b Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
🧪 Test Quality Sentinel ReportTest Quality Score: 90/100✅ Excellent test quality
Test Classification DetailsView all 3 test functions (15 sub-cases)
Flagged Tests — Requires Review
|
There was a problem hiding this comment.
Pull request overview
Adds first-class support for filtering workflow_run triggers by conclusion via frontmatter (on.workflow_run.conclusion), compiling the filter into a guarded GitHub Actions if expression and propagating the triggering conclusion into agent context/telemetry and docs.
Changes:
- Compile
on.workflow_run.conclusion(string or array) into a guardedifcondition and AND-merge it with any existingif. - Comment out processed
on.workflow_run.conclusionfields in the compiled YAML for transparency. - Propagate
workflow_run_conclusionintoaw_context/aw_infoand emit it as an OTEL span attribute; add docs + Go tests.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/frontmatter_extraction_yaml.go | Extracts/merges workflow_run conclusion conditions and comments out processed YAML fields. |
| pkg/workflow/workflow_run_conclusion_test.go | Adds unit tests for condition extraction/merging and YAML commenting behavior. |
| actions/setup/js/aw_context.cjs | Adds workflow_run_conclusion to propagated aw_context. |
| actions/setup/js/generate_aw_info.cjs | Adds workflow_run_conclusion to aw_info.json when present. |
| actions/setup/js/send_otlp_span.cjs | Emits gh-aw.workflow_run.conclusion OTEL attribute from aw_info/aw_context. |
| .github/aw/create-agentic-workflow.md | Documents on.workflow_run.conclusion usage for monitoring workflows. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 6/6 changed files
- Comments generated: 2
| if strings.Contains(line, "deployment_status:") { | ||
| inDeploymentStatus = true | ||
| inWorkflowRun = false | ||
| inPullRequest = false | ||
| inIssues = false |
| parts := make([]string, 0, len(conclusions)) | ||
| for _, c := range conclusions { | ||
| parts = append(parts, "github.event.workflow_run.conclusion == '"+c+"'") | ||
| } |
…pilation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Commit pushed:
|
🏗️ Design Decision Gate — ADR RequiredThis PR makes significant changes to core business logic (378 new lines in AI has analyzed the PR diff and generated a draft ADR to help you get started: 📄 Draft ADR: What to do next
Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision. Why ADRs Matter
ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you. 📋 Michael Nygard ADR Format ReferenceAn ADR must contain these four sections to be considered complete:
All ADRs are stored in
References: §25108336032
|
|
@copilot review all comments |
…on values Agent-Logs-Url: https://github.com/github/gh-aw/sessions/fd58bd84-68b8-4025-b532-0d6348f258ea Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Addressed both reviewer comments in d6e982c:
Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Add Conclusion Filtering subsection to the Workflow Run Triggers section, mirroring the existing deployment_status.state documentation. The on.workflow_run.conclusion field (added in #29089) compiles into a guarded if: condition at build time, allowing users to filter workflow runs by their conclusion without writing the two-part GitHub Actions expression guard manually. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
Adds support for
on.workflow_run.conclusion: string | string[]in workflow frontmatter, following the same pattern ason.deployment_status.state.Changes
Compiler (
pkg/workflow/frontmatter_extraction_yaml.go)extractWorkflowRunConclusionConditionthat readson.workflow_run.conclusionand converts it to a guarded GitHub Actions expression:github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'failure'). The event_name guard ensures the condition remains transparent when triggered by other events (e.g.workflow_dispatch).extractIfConditionnow merges the conclusion condition with any existingif:expression via AND.commentOutProcessedFieldsInOnSectionnow tracksinWorkflowRun/inWorkflowRunConclusionArrayand comments out theconclusion:field (and its array items) in the compiled YAMLon:section, with an explanatory comment. Uses a dedicatedinWorkflowRunConclusionArrayflag to avoid incorrectly commentingworkflows:ortypes:array items.Agent context (
actions/setup/js/aw_context.cjs)workflow_run_conclusionfield tobuildAwContext(), populated fromcontext.payload.workflow_run.conclusionwhen triggered byworkflow_run. Propagated to child workflows viaworkflow_call.aw_info (
actions/setup/js/generate_aw_info.cjs)workflow_run_conclusiontoawInfoso the agent can access it without reading the raw event payload.OTEL (
actions/setup/js/send_otlp_span.cjs)gh-aw.workflow_run.conclusionattribute to both the setup span and conclusion span, reading fromawInfo.workflow_run_conclusionorawInfo.context.workflow_run_conclusion(aw_context propagation from parent).Docs (
.github/aw/create-agentic-workflow.md)on.workflow_run.conclusion: failureinstead of a manualif:condition. Includes context variable table, two examples (minimal + full with pre-steps), filter syntax reference, and when-to-use checklist.Tests (
pkg/workflow/workflow_run_conclusion_test.go)TestExtractWorkflowRunConclusionCondition— 8 cases covering empty frontmatter, missing keys, single string, single-item array, multi-item array, non-map valueTestExtractIfConditionMergesWorkflowRunConclusion— 5 cases covering no existing if, bare if, wrapped${{ }}if, multiple conclusions, no-conclusion passthroughTestWorkflowRunConclusionCommentedInYAML— 3 cases verifying YAML commenting for string, array, and absent conclusionExample usage
The
conclusion: failurefilter is compiled into:and merged (AND) with any existing
if:condition on the activation job.Closes #29060