# Gate

> BareCI ready is one GitHub check per pull request head, green only when every enabled module agrees, with every reason it is not and the command that fixes it.

Source: https://bareci.com/docs/modules/gate

The Gate posts one GitHub check run per pull request head: **`BareCI: ready`**. Make it required in branch protection. It is green only when every enabled module agrees.

## Conditions

| Module            | Ready when                                                               |
| ----------------- | ------------------------------------------------------------------------ |
| Runners and Tests | Required jobs passed on this head; no new flaky test unacknowledged      |
| Flows             | All flows passed against this head's preview, in strict replay           |
| Reviews           | Required reviewers ran on a recent enough head; no open blocking finding |
| Previews          | Built for this head (when enabled)                                       |
| Policy            | Labels, size limits, required paths                                      |

The Gate counts only the modules enabled for the repository.

## States

| Check state         | When                                                                                  |
| ------------------- | ------------------------------------------------------------------------------------- |
| `completed/success` | Ready                                                                                 |
| `in_progress`       | Only waiting: checks running, a reviewer reviewing, a preview building, a flaky rerun |
| `completed/failure` | Something needs a fix                                                                 |

A failed check whose failing tests are all known to be flaky is re-run up to `maxFlakyReruns` times before it counts.

## The verdict as JSON

```sh
bareci ready --json
```

```json
{
  "ready": false,
  "sha": "4e1c9a2…",
  "reasons": [
    {
      "module": "reviews",
      "kind": "blocking",
      "message": "1 open high finding",
      "fix": "bareci findings"
    }
  ]
}
```

Each reason is `pending` or `blocking`, with a message, the fix and sometimes a link. `bareci ready` exits 0 when the pull request is ready. `--wait` holds while every reason is pending. Over MCP, use `ready`.

## Merge queue

On `merge_group` the Gate posts the pull request's verdict on the merge queue's commit. With `mergeQueue` on, a ready pull request is enqueued once per head.

## Settings

| Setting           | Default                  |
| ----------------- | ------------------------ |
| `requiredChecks`  | Every check that reports |
| `requireAnyCheck` | `true`                   |
| `previewRequired` | `false`                  |
| `mergeQueue`      | `false`                  |
| `maxFlakyReruns`  | `2`                      |

See the [Gate API](https://bareci.com/docs/api/gate).
