# CI checkup

The checkup reads a repo's last month of GitHub Actions runs (or GitLab pipelines), prices them next to Groundbox, and lists the slowest jobs, flaky tests and the fixes, each at a file and line with the minutes it saves. It is the report at [/ci-cost](https://groundbox.dev/ci-cost) and on the dashboard's [Checkup](https://app.groundbox.dev/checkup) page, in the terminal:

```
groundbox ci checkup acme/app
groundbox ci checkup gitlab.com/acme/app
groundbox ci checkup acme/app --json
```

- With an API key that has `ci:read`, a repo connected to your team (or a GitLab project your Connect GitLab account can read) is read through Groundbox, so private repos work.
- Without a key, or for a repo that isn't connected, it reads GitHub's or gitlab.com's public API straight from your machine, like the site does, and says so. `--public` always does that.
- `--token` takes a GitHub or GitLab token of your own. It goes only to that host, and GitHub then allows more reads than the 60 an hour it gives without one.
- `--json` prints the whole report. The last line links to the dashboard, where a CI tune-up turns the fixes into one pull request.

In TypeScript, `run_checkup` returns the same report: through Groundbox with the client's key, or from the public API.

```
import { Groundbox } from "@groundbox/sdk";

const groundbox = new Groundbox(); // GROUNDBOX_API_KEY, with ci:read
const run = await groundbox.run_checkup("acme/app");
console.log(run.source, run.report.totals, run.fixes.map((fix) => `${fix.title}: ${fix.worth}`));
```

Python has the raw reads only, as `checkup_read`; the report is worked out by the TypeScript checkup. With a `ci:read` key the reads are, in GitHub's own shapes:

```
GET /v1/ci/checkup/repos/{owner}/{name}/actions/runs?created=>=YYYY-MM-DD&per_page=100&page=1
GET /v1/ci/checkup/repos/{owner}/{name}/actions/runs/{run_id}/jobs
GET /v1/ci/checkup/repos/{owner}/{name}/actions/runs/{run_id}/attempts/{attempt}
GET /v1/ci/checkup/repos/{owner}/{name}/contents/.github/workflows/{file}
```

```
gb.checkup_read("acme/app", "actions/runs", created=">=2026-10-22")
gb.checkup_read("gitlab:acme/app", "pipelines", created_after="2026-10-22T00:00:00Z")
```

GitLab projects have the same under `/v1/ci/checkup/gitlab/projects/{id or path}`: the project, `/pipelines`, `/pipelines/{id}/jobs` and `/repository/files/{path}/raw`. The SDKs have them as `checkup_read` too.
