PR Buildkite Detective (Elastic-specific)¶
Analyze failed PR checks backed by Buildkite and report findings (read-only).
Workflow source: gh-aw-estc-pr-buildkite-detective.md
How it works¶
Triggered automatically when a commit status or check run reports a failure. Looks up the related Buildkite build via MCP, analyzes failed jobs/logs/annotations, and posts a comment with root cause and recommended fixes. Read-only — never pushes changes.
Quick Install¶
mkdir -p .github/workflows && curl -sL \
https://raw.githubusercontent.com/elastic/ai-github-actions/v0/gh-agent-workflows/estc-pr-buildkite-detective/example.yml \
-o .github/workflows/estc-pr-buildkite-detective.yml
Trigger¶
| Event | Types | Condition |
|---|---|---|
status |
N/A | Commit status changed to failure |
check_run |
completed |
Check run completed with conclusion failure |
Inputs¶
| Input | Description | Required | Default |
|---|---|---|---|
additional-instructions |
Repo-specific instructions appended to the agent prompt | No | "" |
setup-commands |
Shell commands run before the agent starts | No | "" |
allowed-bot-users |
Allowlisted bot actor usernames (comma-separated) | No | github-actions[bot] |
buildkite-org |
Buildkite organization slug | No | elastic |
buildkite-pipeline |
Buildkite pipeline slug (auto-discovered if not provided) | No | "" |
Required Secrets¶
COPILOT_GITHUB_TOKENBUILDKITE_API_TOKEN(optional — omit for public pipelines; the workflow will fetch logs from public Buildkite build pages instead)
Safe Outputs¶
add-comment— post a comment explaining the failure (max 3)
Example Workflow¶
name: Estc PR Buildkite Detective
on:
status:
check_run:
types: [completed]
permissions:
actions: read
contents: read
discussions: write
issues: write
pull-requests: write # required by gh-aw compiler for add-comment (github/gh-aw#16673)
jobs:
run:
if: >-
(github.event_name == 'status' && github.event.state == 'failure') ||
(github.event_name == 'check_run' && github.event.check_run.conclusion == 'failure')
uses: elastic/ai-github-actions/.github/workflows/gh-aw-estc-pr-buildkite-detective.lock.yml@v0
with:
buildkite-org: "elastic"
# buildkite-pipeline: "your-pipeline" # auto-discovered if omitted
secrets:
COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }}
BUILDKITE_API_TOKEN: ${{ secrets.BUILDKITE_API_TOKEN }} # optional; omit for public pipelines