> For the complete documentation index, see [llms.txt](https://docs.flxbl.io/flxbl/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flxbl.io/flxbl/codev/governance/branch-protection.md).

# Branch protection and required checks

When codev validates a pull request, it posts the result back to the pull request as a **check**. On its own, that check is informational — codev reports the outcome, but it does not stop anyone from merging. The merge is gated by your **source provider**: you make codev's check (and, if you want, a review approval) *required* through branch protection, and the provider then blocks the merge until they pass.

This page shows how to require codev's validation check and a review before merge, on GitHub and on Azure DevOps.

## The checks codev posts

On every validated pull request, codev posts:

| Check                      | What it means                                                                                                                                                                                                      |
| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **`codev: PR Validation`** | The pull request was deployed to a review environment and its tests were run. Green means the change deployed and passed; red means it failed. See [Change validation](/flxbl/codev/inspect/change-validation.md). |
| **`codev: PR Analysis`**   | The impact and (if enabled) AI analysis of the change. See [Change analysis](/flxbl/codev/inspect/change-analysis.md).                                                                                             |

The check you normally require before merge is **`codev: PR Validation`**.

{% hint style="info" %}
A provider only offers a check as "required" **after it has run at least once** on the repository. Open one pull request and let codev validate it first — then `codev: PR Validation` will appear in the list of checks you can require.
{% endhint %}

## GitHub

<figure><img src="/files/iho9KqMOJe2g7nJ8tUIF" alt="codev change validation results, reported to pull requests as the codev: PR Validation check"><figcaption><p>codev validates each pull request and reports the outcome as the <code>codev: PR Validation</code> check — branch protection turns that check into a merge gate.</p></figcaption></figure>

In your repository on GitHub, go to **Settings > Branches** (or **Settings > Rules > Rulesets**) and add or edit a rule for the branch you protect — usually your default branch.

**Require the validation check:**

1. Enable **Require status checks to pass before merging**.
2. Search for and add **`codev: PR Validation`**.
3. Optionally enable **Require branches to be up to date before merging** so the check always runs against the latest target.

**Require a review (pull request approval):**

1. Enable **Require a pull request before merging**.
2. Set **Require approvals** to the number of reviewers you want (for example 1).

With both in place, a pull request cannot be merged until `codev: PR Validation` is green **and** it has the required review approvals.

## Azure DevOps

On Azure DevOps, the same validation result is posted as a **pull request status** under the **`sfp`** genre — you will see **`codev: PR Validation`** in the pull request's status list. You require it with a branch policy.

In **Project settings > Repositories > (your repo) > Policies**, on the protected branch:

**Require the validation check:**

1. Under **Status Checks**, add a policy.
2. Choose the status **`codev: PR Validation`** (genre `sfp`). If it isn't listed yet, let codev validate one pull request first so the status has been posted.
3. Set it to **Required**.

**Require a review:**

1. Enable **Require a minimum number of reviewers** and set the count.

## How it fits together

* codev **runs** the validation and **reports** the `codev: PR Validation` check on the pull request.
* Your provider's **branch protection** turns that check (and the review) into a **merge gate**.
* Each time codev re-validates — for example after a new commit — it updates the same check, so the gate reflects the latest result.

This keeps the decision where it belongs: codev proves the change deploys and passes, your reviewers approve it, and the branch cannot merge until both are satisfied.

## Related

* [Change validation](/flxbl/codev/inspect/change-validation.md) — what the validation check runs and how to configure it
* [Change analysis](/flxbl/codev/inspect/change-analysis.md) — the `codev: PR Analysis` check
* [Approvals](/flxbl/codev/governance/approvals.md) — the deployment approval gates that apply after merge, when releasing


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.flxbl.io/flxbl/codev/governance/branch-protection.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
