> ## Documentation Index
> Fetch the complete documentation index at: https://docs.garnet.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Auto-merge with GitHub

> Use required CI and Garnet readiness checks with native GitHub auto-merge.

GitHub merges the PR when its required checks and reviews are satisfied. Add [`Garnet record ready`](https://docs.garnet.ai/reference/checks#garnet-record-ready) alongside your CI checks to make GitHub wait for the App to finish reporting evidence for the current commit.

```mermaid theme={null}
flowchart TD
    A["Push a PR commit"] --> B["CI runs; Garnet records"]
    B --> C{"Garnet record ready"}
    C -->|"Pending or missing"| D["GitHub waits"]
    C -->|"Success or neutral"| E["Readiness requirement met"]
    E -->|"CI and any required reviews pass"| F["GitHub auto-merges"]
```

**1. Install the App and record a PR**

[Install the Garnet GitHub App](https://github.com/apps/garnet-runtime-review/installations/select_target) on your repository. If prompted on an existing installation, accept the App's **Checks: Read and write** permission.

In your existing PR workflow, use this order in the Linux x86\_64 job you want to record. Keep its existing permissions and build and test steps.

```yaml wrap theme={null}
permissions:
  contents: read
  id-token: write

steps:
  - uses: actions/checkout@v6
  - uses: garnet-org/action@24833a47c19aad605bb10bcd9b8cad8f318ca187 # v2.6.0
```

The Action selects its own sensor version. See the [quickstart](https://docs.garnet.ai/quickstart.md#add-the-action-to-your-workflow) for token and reusable-workflow setup.

**2. Require CI and Garnet readiness**

First, open an eligible test PR and verify that **Garnet record ready** appears for its current head. Then, in the target branch's [ruleset or branch protection rule](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets#require-status-checks-to-pass), turn on **Require status checks to pass**. Select your normal CI checks and **Garnet record ready** from the Garnet Runtime Review App. Keep any required reviews.

Require the check only where your recording workflow runs reliably. If the check is missing, inspect whether the job ran, the App has access and the Checks grant was accepted.

Use native auto-merge without a [merge queue](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue) when requiring this check. The App posts on the PR head, not the merge-group commit, so the queue cannot satisfy this requirement.

**3. Read the current-head evidence**

**On GitHub:** Humans read the finalized App comment for the current PR head. The `Garnet record ready` title summarizes the result; native auto-merge uses the check's conclusion, not the comment.

**In a coding-agent session:** Use [Garnet MCP](https://docs.garnet.ai/consume.md#coding-agents-and-the-garnet-mcp): call `pr_review` for the PR result and `profiles` for job detail. Require `status: finalized`, `bound_to_head: true`, and matching `head_sha` and `marker_commit` before using the result. If `pr_review` is unavailable, errors, or returns an unusable result, fall back to the finalized current-head App comment. Treat unusable evidence as unknown.

Inspect any newly recorded connections before opting in.

**4. Enable GitHub auto-merge**

In **Settings → General → Pull Requests**, turn on **Allow auto-merge**. On an eligible PR, choose **Enable auto-merge**, or run this from the PR branch if the repository allows squash merging:

```sh theme={null}
gh pr merge --auto --squash
```

Try this while a required CI check is pending. The PR should stay open until the requirements are met. After a new push, auto-merge normally stays enabled and GitHub re-evaluates required checks, including `Garnet record ready`, for the new head. [GitHub disables auto-merge](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request) if someone without write permissions pushes new changes to the head branch or switches the base branch.

## What the readiness check means

| Check state | Meaning | If required in GitHub |
| - | - | - |
| In progress or missing | The current head has no completed check. | Waits. |
| Success | A record finalized. The title says **unchanged**, **new behavior**, or **first record**. | Satisfied, even with new behavior. |
| Neutral | Evidence was incomplete, skipped, or otherwise unavailable. | Satisfied. A neutral result is not evidence of no change. |

Readiness is not approval or proof of complete capture. Let GitHub handle the merge: skip approval bots and workflows that parse PR comments and call the merge API with write permissions.

## Optional: stricter policy (preview)

If new behavior or unavailable evidence should hold a merge, require a separate policy check. The Claude Ship exhibit's [`garnet/runtime-diff`](https://docs.garnet.ai/research-preview/claude#claude-ship-inspect-and-rerun-after-a-fix) is a repository-owned research preview that can fail. The Garnet App and Action do not install it. Use GitHub to enforce any policy check you choose to add.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.