Add branch-actions-detective for failed main CI runs#372
Conversation
Co-authored-by: strawgate <6384545+strawgate@users.noreply.github.com>
📝 WalkthroughWalkthroughThis pull request introduces a comprehensive GitHub Actions workflow system called "Branch Actions Detective" that automatically detects and triages failed CI runs on protected branches without associated pull requests, analyzing root causes and creating or updating tracking issues with remediation suggestions. Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub as GitHub Actions
participant Pre as pre_activation Job
participant Act as activation Job
participant Agent as agent Job<br/>(Copilot)
participant Det as detection Job
participant Safe as safe_outputs Job<br/>(MCP)
participant Conc as conclusion Job
participant Issue as Issue Tracker
GitHub->>Pre: Trigger on failed CI workflow_run
Pre->>Pre: Check membership & permissions
Pre->>Act: Pass membership validation
Act->>Act: Activate workflow context
Act->>Agent: Proceed if authorized
Agent->>Agent: Setup Copilot<br/>Generate dynamic prompt<br/>Analyze failing CI logs
Agent->>Agent: Create aw_info metadata
Agent->>Det: Pass analysis results
Det->>Det: Analyze agent outputs<br/>Cross-reference threat data
Det->>Safe: Send detection findings
Safe->>Safe: Configure MCP servers<br/>Apply safe-output tooling<br/>Validate outputs
Safe->>Conc: Output safe results
Conc->>Conc: Aggregate all results<br/>Deduplicate by root cause
Conc->>Issue: Create/Update tracking issue<br/>with root cause & remediation
Conc->>GitHub: Report conclusion
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
Failed CI runs on the default branch without an associated PR were not auto-triaged. Existing
pr-actions-detectiverequires a PR context and noops otherwise.What this PR adds
.github/workflows/gh-aw-branch-actions-detective.lock.yml.github/workflows/gh-aw-branch-actions-detective.md.github/workflows/trigger-branch-actions-detective.ymlgh-agent-workflows/branch-actions-detective/example.ymlgh-agent-workflows/branch-actions-detective/README.mdTrigger conditions
The detector runs on
workflow_run(completed) for"Internal: CI","CI","Build", and"Test", and only when all conditions are true:github.event.workflow_run.conclusion == 'failure'github.event.workflow_run.head_branch == github.event.repository.default_branchtoJSON(github.event.workflow_run.pull_requests) == '[]'Detection + dedup behavior
create-issuesafe output.[branch-actions-detective]title prefix for dedup.noopinstead of filing a duplicate when an open issue already tracks the same root cause.close-older-issues: trueandexpires: 7dto keep stale issues under control.Consumer install
Fixes #370