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

# Git v2 pull request checks

> The build, sync, and validation checks that Git v2 runs on each pull request, what you see in GitHub, and how to block a merge on a failed check.

> [!NOTE]
>
> Git v2 is available for GitHub repositories. To have Git v2 turned on for your organization, reach out to Omni support.

With [Git v2](https://docs.omni.co/integrations/git/v2), Omni checks each pull request that changes a model's files.

## How it works

When a commit arrives on a pull request branch, Omni checks it together with the latest changes on the [base branch](https://docs.omni.co/integrations/git/settings.md#base-branch). The results show what the shared model will be after the pull request merges.

Omni runs three checks, in this order:

1. **Build**: Confirms that Omni can read the model files.
2. **Sync**: Confirms that the pull request and its Omni branch match.
3. **Validation**: Counts the validation errors the change introduces.

Omni reports the result on the pull request in GitHub as a commit status and a comment. See [What you see on the pull request](#what-you-see-on-the-pull-request).

You set the severity of each check in a [configuration file](https://docs.omni.co/integrations/git/v2/config-file.md) in the repository. To stop a pull request from merging when a check fails, see [Block merges on a failed check](#block-merges-on-a-failed-check).

Omni also runs the build and validation checks on each commit to the base branch before it pulls the commit into the shared model. See [Checks on base branch commits](https://docs.omni.co/integrations/git/v2/merging.md#checks-on-base-branch-commits).

## Pull request checks

The build and validation checks need an Omni branch for the pull request. To have Omni create a branch for every pull request, turn on [Always create branches](https://docs.omni.co/integrations/git/settings.md#always-create-branches). If the pull request has no Omni branch, Omni skips the build and validation checks. See [The pull request has no Omni branch](https://docs.omni.co/integrations/git/v2/troubleshooting.md#the-pull-request-has-no-omni-branch).

### Build

The build check confirms that Omni can read the model files in the commit. It fails in these cases:

* A file isn't valid YAML.
* A required parameter is missing.
* A parameter has an invalid value.
* Two parameters can't be used together. For example, a view has both `query` and `sql`.

If the build check fails, the commit status fails. The comment shows `Omni could not read the model files` with the error underneath, and Omni skips the sync and validation checks. To fix it, see [The build check fails](https://docs.omni.co/integrations/git/v2/troubleshooting.md#the-build-check-fails).

### Sync

The sync check confirms that the pull request and its Omni branch match. It fails in these cases:

* Omni couldn't pull the commit into the branch.
* The Omni branch has edits that aren't pushed to the pull request.
* The Omni branch has edits that conflict with the pull request. See [Resolve conflicts](https://docs.omni.co/integrations/git/v2/conflicts.md).

When the sync check passes, the comment says what Omni did with the commit. For example: `These changes are already loaded into Omni`, or `Omni has not pulled this commit into the branch yet; pull it from the IDE`.

### Validation

The validation check runs [model validation](https://docs.omni.co/modeling.md#validation) on the pull request. It fails when the pull request introduces a validation error.

The comment shows the number of new errors and warnings, and the number of issues that already exist in the shared model. For example: `1 new error, 2 existing issues not counted`. The comment also lists up to 15 of the new issues, with the message and YAML location for each.

## What you see on the pull request

### Commit status

Omni posts one commit status for each model in the repository. The status name is `Model:` followed by the [model path](https://docs.omni.co/integrations/git/settings.md#model-path), such as `Model: omni/Marketing`.

| Status | Text | Meaning |
| - | - | - |
| Pending | `Running checks` | Omni is running the checks for the commit. |
| Success | A summary of each check, such as `✅ Build · ✅ Sync · ✅ Validation` | Every check set to `error` passed. See [severity](https://docs.omni.co/integrations/git/v2/config-file.md#severity-and-defaults). |
| Success | `This pull request does not change the model` | The pull request doesn't change the model's files. Omni doesn't run the checks or post a comment. |
| Failure | A summary of each check, such as `❌ Build · » Sync · » Validation` | A check set to `error` failed. |
| Failure | `.omni/config.yaml did not parse: <reason>` | Omni couldn't read the [configuration file](https://docs.omni.co/integrations/git/v2/config-file.md). The checks didn't run. |
| Error | `Omni could not load this commit` | Omni couldn't read the commit, so the checks didn't run. See [Troubleshooting](https://docs.omni.co/integrations/git/v2/troubleshooting.md#omni-cant-load-a-commit). |

In the summary, each check has one of these markers:

* ✅ - The check passed.
* ❌ - The check failed.
* » - Omni skipped the check.

A passing status shows ❌ for a failed check that is set to `warn`. For example, with the default settings, a commit with validation errors gets a passing status that reads `✅ Build · ✅ Sync · ❌ Validation`.

The **Details** link on the status opens Omni's comment on the pull request.

### Comment

Omni posts one comment for each model and updates the same comment on each new commit. The comment shows the result of each check and links to the branch in Omni. For example:

```markdown title="Example comment" theme={null}
## Model: omni/Marketing
_Commit `3f9c2ab`: all checks passed._

- ✅ **Build**: passed
- ✅ **Sync**: These changes are already loaded into Omni
- ✅ **Validation**: passed

_These checks ran with Omni's default settings. You can override them in .omni/config.yaml._

[Open the branch in Omni](https://example.omniapp.co/models/<branch_id>/ide)
```

## Block merges on a failed check

To block a merge on a failed check, set the check's severity to `error` and require the commit status in GitHub.

**1. Set the check's severity to error**

By default, the build check is the one check set to `error`. To have a failed sync or validation check fail the commit status too, set `sync` and `validation` to `error` in [`.omni/config.yaml`](https://docs.omni.co/integrations/git/v2/config-file):

```yaml title=".omni/config.yaml" theme={null}
version: 1
checks:
  sync: error
  validation: error
```

**2. Require the status in GitHub**

In GitHub, add a branch protection rule for the repository's base branch that requires status checks to pass before merging. Select the status named `Model: <model_path>` for each model that must pass, such as `Model: omni/Marketing`.

See GitHub's documentation on [protected branches](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches#require-status-checks-before-merging) for the steps.

## Next steps

* [Set up Git v2 with GitHub](https://docs.omni.co/integrations/git/v2/setup/github.md)
* [Configuration file](https://docs.omni.co/integrations/git/v2/config-file.md)
* [Git v2 settings](https://docs.omni.co/integrations/git/v2/settings.md)
* [Troubleshooting Git v2](https://docs.omni.co/integrations/git/v2/troubleshooting.md)
