analyze-ci-failures
Analyze CI failures on Azure SDK for .NET pull requests and post a comment with how-to-fix instructions. Use when a PR has failing checks, CI is red, or someone asks for help fixing CI.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6.1k
- Forks
- 5.2k
01 前言 Front Matter
- name
- analyze-ci-failures
- description
- Analyze CI failures on Azure SDK for .NET pull requests and post a comment with how-to-fix instructions. Use when a PR has failing checks, CI is red, or someone asks for help fixing CI.
03 SKILL.md 正文
Skill: analyze-ci-failures
Analyze CI failures on an Azure SDK for .NET pull request and post a GitHub comment with actionable fix instructions.
When Invoked
Trigger phrases: "analyze CI failures", "fix CI", "why is CI failing", "help with CI", "analyze PR checks", "CI is red", "failing checks".
Inputs
The user must provide a PR number, PR URL, or pipeline build ID. If not provided, ask the user.
An automatic caller also supplies the immutable PR head SHA, check run ID, and completion timestamp. Analyze that completion only, not a newer run. Check-run events do not expose run_attempt; a changed completion timestamp distinguishes another attempt when the provider reuses its check ID. Follow the caller's safe-output and duplicate-prevention contract instead of posting directly.
Workflow
1. Gather information
- Fetch PR details, check statuses, changed files, and workflow runs using GitHub MCP tools.
- When a caller supplies a completion identity, verify the PR is still open, non-draft, and at that head, and that the check still identifies the same completed failure. Stop without commenting if it is superseded. Retrieve errors from that run/attempt only; other current check statuses are context, not evidence for its diagnosis.
- Extract service directory and package name from changed file paths (
sdk/<service>/<package>/). - Identify the CI provider from each failed check URL before fetching logs:
- For an Azure DevOps URL (
dev.azure.com), extract thebuildId. Useazure-sdk-mcp:azsdk_analyze_pipelinewhen available. - If that tool is unavailable, query the public Azure DevOps timeline API with
curl:https://dev.azure.com/<organization>/<project>/_apis/build/builds/<buildId>/timeline?api-version=7.1. Inspectissueson failed task records first. If the issues are insufficient, fetch the failed record'slog.url. - For a GitHub Actions URL, use
github-mcp-server-get_job_logswithreturn_content: true.
- For an Azure DevOps URL (
- Do not use GitHub Actions job-log tools for Azure DevOps checks; their job IDs and run IDs are unrelated.
2. Identify failures
Classify each failure using the CI check mapping and log symptom patterns below. Also inspect the PR's code directly (e.g., read generated files for compile errors, check for missing scaffolding files).
Diagnosis must be based on the failed task's actual error text:
- Quote the decisive error and name the affected file or project.
- Do not infer the root cause from the check name, because
Build/Packjobs also run changelog verification, package validation, and ApiCompat. - Do not call a failure transient or flaky unless the logs contain infrastructure evidence (for example, an agent disconnect, timeout, service outage, or network failure). A documentation-only last commit does not establish flakiness because packaging validates files such as
CHANGELOG.md. - If logs cannot be retrieved, state that the root cause is unconfirmed and provide the failed task link. Do not substitute a guessed compilation or ApiCompat diagnosis.
3. Post a comment
Compose a GitHub comment with:
- Header:
## ? CI Failure Analysis for PR #<number> - Summary table: All checks with ✅ ❌ ⏳ status
- Per-failure sections: Specific to THIS PR — include actual error messages, affected files, and concrete fix commands with
<service>/<package>filled in - Quick fix command at the end if applicable
Before posting, check existing bot comments for the same PR/head/CI run/completed attempt, not just the ## ? CI Failure Analysis header. An older report must not suppress analysis of a new failure. Preserve the caller's exact completion marker when provided; the standalone workflow adds and verifies its marker deterministically at publication.
CI Check Name → Failure Mapping
These are the Azure DevOps and GitHub checks that run on SDK PRs. The check names are repo-specific and not discoverable from general knowledge.
| Check Name Pattern | What It Validates | Key Script |
|---|---|---|
Build Analyze PRBatch |
Umbrella: code generation, API export, snippets, spelling, CPM, build + pack | eng/scripts/CodeChecks.ps1 |
Verify Generated Code |
Generated code matches what the generator produces | eng/scripts/CodeChecks.ps1 |
Validate CPM Compliance |
Central Package Management policy | eng/scripts/Validate-CpmCompliance.ps1 |
Build / Pack |
Compilation + package validation, including changelog verification and ApiCompat | dotnet pack |
Analyze |
Samples, READMEs, snippets compile | eng/scripts/Build-Snippets.ps1 |
check-spelling |
Spell-checking changed files | cspell via eng/common/scripts/check-spelling-in-changed-files.ps1 |
verify-links |
Markdown link validation | eng/common/scripts/Verify-Links.ps1 |
checkenforcer |
Meta-check: waits for all other checks to pass | .github/workflows/event-processor.yml |
Log Symptom → Root Cause Mapping
These are exact strings/patterns to search for in CI logs. They are specific to this repo's scripts and not inferrable from general knowledge.
| Log symptom | Root cause | Category |
|---|---|---|
Generated code is not up to date |
Generated code out of sync | Regenerate code |
git diff --exit-code failure in CodeChecks |
Generated or API files changed after re-running scripts | Regenerate + export API |
error CS####: |
C# compilation error | Build failure — inspect the specific error code |
Build FAILED |
Compilation failure | Build failure |
MembersMustExist / TypesMustExist |
ApiCompat breaking change (only surfaces in dotnet pack) |
API compatibility |
changelog entry has the following sections with no content |
Release-dated changelog contains empty template sections | Changelog validation |
ChangeLog verification failed / Verify-ChangeLog.ps1 |
Changelog format or content validation failed; use the preceding error for the exact issue | Changelog validation |
ManagePackageVersionsCentrally / VersionOverride |
CPM policy violation | CPM compliance |
cspell unknown words |
Spelling error in code or API surface | Spelling |
Spell check failed |
Spelling error in API surface files | Spelling |
README instruction format / NuGet\\Install-Package |
README uses wrong install format (must use dotnet add package) |
README validation |
verify-links broken URL |
Broken markdown links | Link verification |
| Path length exceeded | File path > 210 chars | File path issue |
New Package Checklist
For PRs that introduce a new SDK package (all files are added, no prior version exists), also check for these commonly missing scaffolding files:
Use this checklist only to explain a CI failure, not as an independent code review or a source of unrelated findings.
CHANGELOG.mdREADME.mdDirectory.Build.props(must import parent props)ci.mgmt.yml(for management-plane) or CI pipeline configapi/*.cs(public API surface listings — generated viaExport-API.ps1)assets.json(test recording assets)
Without ci.mgmt.yml, the Azure DevOps CI pipeline won't trigger — this is a common reason for checkenforcer staying permanently pending.
04 同仓库更多 Skills
update-chat-api
Use when: updating, exporting, refreshing, or validating the public API baseline for Azure.Messaging.WebPubSub.Chat after a public API change.
search-documents
E2E workflow skill for Azure.Search.Documents SDK (TypeSpec + heavy customization). Handles full release cycles and partial updates: SHA update; code generation; build; customization fixes; ServiceVersion sync; testing; API export; changelog; version; samples; formatting; release metadata. WHEN: create new package version for Azure.Search.Documents; regenerate Azure.Search.Documents; fix Azure.Search.Documents bug; release Azure.Search.Documents; update Azure.Search.Documents spec. Do not use for Azure.ResourceManager.Search or Azure.Provisioning.Search.
search-documents-version-diff
Diff the current Azure.Search.Documents public API surface against a previous published version and detect preview-to-preview regressions where the SDK customization layer was not bubbled up after a TypeSpec change. Use whenever the user asks to compare Azure.Search.Documents betas, verify no Azure.Search.Documents preview features dropped, regression audit between Azure.Search.Documents versions, sanity-check a release branch for Azure.Search.Documents, or investigate a missing Azure.Search.Documents preview feature — even if they don't say the word "diff". Specifically catches dropped wrappers (QueryAnswer/QueryCaption/QueryRewrites style), lost SearchOptions aggregator redirectors, `@@access("internal")` flips, deleted-instead-of-gated `#if AZURE_SEARCH_PREVIEW` blocks, dropped `ServiceVersion` enum values, and convenience-to-protocol downgrades.
search-documents-typespec-validation
TypeSpec validation skill for Azure.Search.Documents SDK. Performs a COMPLETE validation of ALL operations, ALL models, ALL enums, and ALL properties against the TypeSpec definition at any pinned commit. Works for any API version. Generates a full gap report: missing features, extra features, naming mismatches, and recommended fix location. WHEN: "validate Azure.Search.Documents SDK against TypeSpec", "detect Azure.Search.Documents typespec feature gaps", "what is missing from the Azure.Search.Documents SDK", "compare Azure.Search.Documents SDK to spec", "full spec coverage audit for Azure.Search.Documents". Do NOT use for version-to-version diff or regression detection — use search-documents-version-diff instead.
test-skill_file
Roll dice using a random number generator.
roll-dice
Roll dice using a random number generator. Use when asked to roll a die (d6, d20, etc.), roll dice, or generate a random dice roll.