# Read CI results and logs

Once [Buildkite is connected](https://staging.git.cafe/docs/ci/buildkite.md), GitCafe shows build results on
the repository's **CI** tab and as checks on pull requests and commits.

## See checks on a pull request

The checks panel on a pull request's **Conversation** tab lists every check on
its latest commit: Buildkite and GitCafe checks, commit statuses and checks
imported from GitHub. The badge summarizes them all, and each check links to
its run.

Required checks are set with [rulesets](https://staging.git.cafe/docs/repositories/repository-rulesets.md);
a pull request cannot merge until they pass on the exact commit being merged.

```sh
cafe ci status --pr 42
```

## Browse runs

Open the repository's **CI** tab to list runs. Filter by status and page back
through older runs; active runs refresh while the page is open. Select a run to
see its jobs and logs.

```sh
cafe ci list --branch main
cafe ci watch <run-id>
```

`cafe ci watch` waits until the run finishes.

## Read a job log

Open a run, or a check's **View jobs and logs** link. Failed jobs are listed
first, and the first failed job's log opens automatically. The job is part of
the address, so you can share a link to it.

The viewer shows the log as it appeared in the terminal, with colours and
progress lines:

- It starts with the last 256 KB. **Load 256 KB more** loads earlier output;
  **Load the whole log** loads all of it.
- The failures button steps through lines that report a failure: failed tests,
  compiler errors, panics and non-zero exit codes.
- Search finds text in the loaded output (Enter for next, Shift+Enter for
  previous). **Sections** jumps to a Buildkite section header.
- **Download** saves the whole log; **Copy** copies the loaded part.
- While a job runs, new output appears every few seconds. **Latest output**
  jumps back to the end.

Logs are available only when the repository [shares them](https://staging.git.cafe/docs/ci/buildkite.md#share-job-logs).
A job that has not started has no log yet; a step Buildkite never ran on this
build (for example one its branch filter excludes) is listed as **Skipped**.

## Download logs from the CLI

```sh
cafe ci jobs <run-id>
cafe ci logs <run-id> --job <job-id> --output job.log
cafe ci logs <run-id> --job <job-id> --tail 200
```

`--full` prints the whole log, `--tail N` the last N lines, and
`--bytes FIRST-LAST` one byte range.
