Skip to main content
Glama
README.md
# gh-repro

**Deterministic 1-line local reproducers from failing GitHub Actions runs — without Docker.**

`gh-repro` reads a failing GitHub Actions run (`gh run view --log-failed`) alongside your `.github/workflows/*.yml`, strips timestamps/ANSI/group noise, redacts accidental tokens, and outputs the exact minimal local command (`pytest`, `go test`, `vitest`, `jest`, `cargo test`) with the failing step's `working-directory` and `env`.

## Why `gh-repro`?

- **`nektos/act`** spins up Docker to re-run entire workflows (slow, heavy, and often breaks on GitHub secrets or hosted services).
- **`gh run view --log-failed`** dumps thousands of raw log lines mixed with UTC timestamps and ANSI codes.
- **`gh-repro`** gives you the exact failing test node and `cwd`/`env` in < 1 second — both for humans (`gh repro`) and coding agents (`gh repro --mcp`).

## Install

```bash
gh extension install dev-shiki/gh-repro
```

Or build from source (Go 1.24+):

```bash
go install github.com/dev-shiki/gh-repro@latest
```

## Usage

```bash
# Inspect the latest failed workflow run in the current repo
gh repro

# Inspect failing checks on PR #123
gh repro --pr 123

# Inspect a specific run ID and emit JSON
gh repro --run-id 123456789 --json

# Offline mode from a saved `gh run view --log-failed` file
gh repro --log-file failed.log

# Execute the extracted minimal repro command locally (never runs without --run)
gh repro --pr 123 --run
```

Example output:

```text
[1] test-python / Run pytest (pytest)
    cwd: backend
    env: map[APP_ENV:test DATABASE_URL:sqlite:///:memory:]
    cmd: pytest tests/test_auth.py::TestToken::test_refresh
    err: FAILED tests/test_auth.py::TestToken::test_refresh - AssertionError: expired token [REDACTED]
```

## MCP Server Mode (Claude Code / Cursor / Windsurf / Antigravity)

The same single binary exposes a zero-dependency stdio MCP server (`reproduce_ci_failure`, read-only):

```json
{
  "mcpServers": {
    "gh-repro": {
      "command": "gh",
      "args": ["repro", "--mcp"]
    }
  }
}
```

## Security Design

- **Safe by default:** Never executes extracted commands unless `--run` is explicitly passed.
- **No shell injection:** `--run` invokes `exec.Command(bin, args...)` directly without `sh -c` interpolation.
- **Secret redaction:** Masks `ghp_`, `github_pat_`, `AKIA`, `sk-`, and `Bearer` tokens in extracted error tails.
- **Safe YAML:** Uses `gopkg.in/yaml.v3` structured decoding on `.github/workflows/*.yml`.

TDQS

A3.9/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool in the set, there is zero risk of misselection; the tool's purpose (extracting a minimal repro from a failing GitHub Actions run) is unmistakable and read-only.

Naming Consistency4/5

The single name `reproduce_ci_failure` follows a clean snake_case verb_noun pattern that would scale predictably, but with only one tool there is no actual pattern to be consistent across.

Tool Count3/5

One tool is borderline thin even for a narrow purpose; a plausible companion like listing recent failing runs or fetching full logs would round out the surface without bloat.

Completeness3/5

The tool returns a rich bundle (command, cwd, env, error tail), but there is no way to discover which run failed or drill into raw logs, leaving an agent dependent on input it must obtain elsewhere.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues