SuperAPIAI Directory

gha-doctor

github.com · AI coding

Read-only GitHub Actions health checks: wasted CI compute costs, flaky tests from job logs, slow-run analysis and workflow linting with auto-fix previews.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS · Linux

About this tool

gha-doctor is a diagnostic tool focused on GitHub Actions speed, cost, and reliability. It is built and maintained by AI agent Linnea Bakshi, runs in a read-only manner, and does not modify repository contents. Unlike actionlint (which checks correctness) and zizmor (which checks security), gha-doctor covers a third area previously uncovered by open-source tools: speed, cost, and reliability.

Purpose

gha-doctor is designed to help developers find inefficiencies and issues in GitHub Actions workflows, including:

  • Flaky jobs: jobs that both fail and succeed on the same commit, wasting billable minutes.
  • Cost issues: missing concurrency cancellation, uncached dependency installation, using expensive macOS runners on every push, the default 6-hour timeout, full-history checkout, etc.
  • Slow steps: aggregate analysis of the time distribution of each step.
  • Cache issues: detecting improperly configured or missed caches.
  • Workflow anti-patterns: static checking of common misconfigurations in YAML.

Main capabilities

  • Zero configuration: Run it inside a repository, read .github/workflows/ for static checks, use existing GITHUB_TOKEN or gh CLI authentication for historical analysis.
  • Health score: All measurement results are summarized into per-item health scores from 0–100, and an SVG badge can be generated via --badge .
  • Remote repository support:--repo owner/name can fetch workflow files and run history for repositories that have not been cloned via the API.
  • Historical analysis: Samples recently completed runs (100 by default), and reports the success rate, p50/p95 duration, average queue time, flaky jobs and their wasted minutes, slowest steps, matrix balance, etc., for each workflow.
  • Automatic fixes:--fix can fix rules D001–D003, D008, D012, D014, and D015, making precise line edits while preserving comments and formatting.
  • Fix preview:--diff shows the unified diff that --fix will apply, without writing anything.
  • Multiple output formats: Supports --json、--sarif、--html、--md , etc.
  • MCP server:--mcp runs as a Model Context Protocol stdio server, allowing MCP clients such as Claude Code and Cursor to diagnose CI in conversation.
  • GitHub Action: Can be used as a composite Action, supporting PR comments, inline annotations, code scanning, baseline comparison, etc.

Usage

Installation methods include:

  • gh CLI extension:gh extension install linnea-bakshi/gha-doctor
  • Homebrew (macOS / Linux)
  • Scoop (Windows)
  • Docker (multi-architecture):docker run -i --rm ghcr.io/linnea-bakshi/gha-doctor:latest --mcp
  • aqua, mise / ubi, asdf
  • Download binaries from the releases page (linux/macOS/windows, amd64/arm64), as well as .deb, .rpm, and .apk packages

Basic usage: run gha-doctor inside the repository.--lint-only requires no authentication. Historical analysis requires setting GITHUB_TOKEN or using gh CLI login.

Using it as a GitHub Action:gha-doctor --init can generate a committable .github/workflows/gha-doctor.yml, lint on every PR, gate only issues introduced by the PR (baseline: auto), and publish sticky comments and inline annotations.

Suitable scenarios

  • Teams looking to reduce their GitHub Actions bill.
  • Developers who need to identify and fix flaky tests.
  • Projects that want to introduce CI health gates into their workflows.
  • Open-source projects that need to add a CI health badge to their repository.
  • AI-assisted workflows that use MCP clients (such as Claude Code and Cursor) for CI diagnosis.
  • GitHub Enterprise Server environments (via GH_HOST and other environment variables are supported).

Limitations

  • The tool only reads, it does not write; automatic fixes must be run explicitly with --fix. - Cost estimates use github.com hosted runner pricing; self-hosted runners (common with GHES) are excluded from cost calculations, so on GHES time-based findings are usually shown instead of dollar figures. - Some rules (such as D004 fetch-depth: 0) are intentionally not auto-fixed, because whether the full history is needed depends on user judgment. - Auto-fix skips ambiguous cases (such as two lock files, streaming YAML, npm install with parameters, etc.) and provides an explanation rather than guessing. - Exit codes: 0 means clean or informational only, 2 means warnings were found, and can be used for CI gating. - Private repositories require a token with Actions: read and Contents: read permissions. - For more information such as the documentation site, rule reference, recipes, and FAQ, visit https://linnea-bakshi.github.io/gha-doctor。
Up/Down to navigate · Enter to open · ESC to closeBrowse all tools