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

# Auto-Approve

> Automatically approve pull requests after a clean code review

## Overview

Auto-approve lets Gitar submit an approving review on your behalf after a clean code review. You define criteria in natural language, and if they are met, Gitar approves the PR without any manual action required.

> [card] Criteria-Driven
>
> Define approval conditions in natural language, or use the default behavior with no criteria at all

> [card] Post-Review Only
>
> Only runs after a clean code review with no blocking findings

> [card] Per-Repo Control
>
> Extend org criteria per repository with a config file

## How It Works

**1. Code review completes**

Gitar reviews the PR as usual. Important or critical findings withhold approval. Approval is also withheld when the configured merge blocking threshold includes unresolved suggestions.

**2. Criteria are checked**

Gitar evaluates your configured criteria against the whole PR, including its changed files and unresolved findings. If no criteria are configured, Gitar approves the PR when the review found no blocking issues.

**3. Approval is submitted**

Gitar submits an approval on the connected code host. The dashboard comment shows the approval and the rationale.

Acknowledged findings count as resolved for approval, even without a code fix. Other approval criteria still apply. See [Providing feedback](https://docs.gitar.ai/features/code-review.md#providing-feedback) for acknowledgement behavior.

## Enabling Auto-Approve

Auto-approve is configured in your organization settings:

1. Navigate to **Settings -> Configuration** in the Gitar dashboard
2. Open the **Behavior** section
3. Enable the **Auto-approve PRs based on code review** toggle
4. Optionally, enter custom approval criteria in the text area that appears

Criteria are written in natural language. Examples:

* "Only approve if the changes are limited to documentation or test files"
* "Approve changes to the `docs/` directory or files ending in `.md`"
* "Skip approval if the PR modifies authentication or payment logic"

> [!NOTE]
>
> Auto-approval criteria are evaluated against the PR metadata, changed files, and code review
> results, not CI pipeline status. Gitar does not verify conditions like "tests pass" or "linting
> is green". Enforce those with your platform's branch protection or merge checks.
>
> Criteria also cannot call integration tools. Naming a Jira, Slack, or [custom MCP](https://docs.gitar.ai/integrations/custom-integrations.md)
> tool in your criteria does not make its result an approval condition, and results from earlier
> integration calls are not passed into the evaluation.

If you change auto-approve or merge blocking settings after a review, Gitar requires a fresh review before submitting a pending automatic approval. Turning off auto-approve prevents pending automatic approvals from being submitted. Actions already sent to the code host may still complete.

### Use PR risk in criteria

Approval criteria can use Gitar's whole-PR risk assessment, for example, "Approve only low- or medium-risk changes." [Risk Triage](https://docs.gitar.ai/features/code-review/risk-triage.md) explains the levels and team-defined policy.

Risk restricts approval after review. Low risk does not bypass blocking findings, and an unavailable assessment does not meet a risk-dependent condition unless the criteria explicitly allow it.

### Require code owner or human approval

On GitHub, criteria can use `CODEOWNERS` and human reviews. For example:

```text theme={null}
Only approve when a code owner other than the author has approved the current head.
```

Gitar reads `CODEOWNERS` from the PR's target branch. It checks who owns the changed files and whether each review applies to the current commit. Team ownership requires the GitHub App's organization **Members: read** permission.

If ownership or review evidence cannot be read, the condition is unmet and Gitar withholds approval. These criteria are unavailable on other code hosts, where they also withhold approval.

If the review history is too large to evaluate completely, Gitar withholds criteria-based approval and auto-merge for that run.

### Default Behavior (No Criteria)

With the toggle enabled and no criteria in organization settings, configuration repositories, or `.gitar/config/approve.md`, Gitar approves PRs with no blocking findings. Minor suggestions may remain unless the configured merge blocking threshold includes them.

## After Approval

When auto-approve fires, you can optionally chain additional actions from the same settings section.

### `gitar-approved` Label

Enable **Apply gitar-approved label** to mark approved PRs. See [`gitar-approved`](https://docs.gitar.ai/labels#gitar-approved) for label behavior.

### Auto-Merge

Enable **Auto-merge PRs** to merge automatically after approval. See [Auto-Merge](https://docs.gitar.ai/features/code-review/auto-merge.md) for platform prerequisites and merge methods.

## Per-Repo Criteria

You can define criteria at the repository level by placing a Markdown file at `.gitar/config/approve.md`. Repo criteria work on their own or alongside org-level criteria.

Gitar reads this file from the default branch. Changes take effect after they merge, so a PR cannot change its own approval policy. If Gitar cannot verify the file, it withholds approval for that run.

See [Repository Customization](https://docs.gitar.ai/configuration/repository-config.md) for more on the `.gitar` directory and how repo-level config files work.

```bash theme={null}
mkdir -p .gitar/config
echo "Only approve if no database migrations are included." > .gitar/config/approve.md
```

### Combination Logic

Organization criteria include shared approval policy from selected [configuration repositories](https://docs.gitar.ai/configuration/configuration-repository.md).

| Org criteria | Repo file | What happens |
| - | - | - |
| Set | Present | Both are combined, so the PR must satisfy all criteria |
| Set | Absent | Org criteria only |
| Empty | Present | Repo file criteria only |
| Empty | Absent | Default: approve unless the review has blocking findings |

## Platform Behavior

Auto-approve works on GitHub, GitLab, Azure DevOps, and both Bitbucket editions. See [Platform Support](https://docs.gitar.ai/connecting-code/platform-support.md) for preview availability.

> [accordion] GitHub
>
> Gitar submits an approving review on the PR. If your branch protection rules require an approving review, this satisfies that requirement.
>
> The review body reads: *"Gitar has auto-approved this PR"* with a link to your auto-approve settings.
>
> If auto-merge is also enabled, the review body mentions that auto-merge has been armed.

> [accordion] GitLab
>
> Gitar approves the MR via the API. If your approval rules list Gitar as an eligible approver, this counts toward the required approval count.
>
> If auto-merge is also enabled, Gitar calls the GitLab API to arm auto-merge after approval.

> [accordion] Azure DevOps
>
> Gitar sets an Approved vote on the PR using the connected service account. If auto-merge is enabled, Gitar also enables auto-complete.

> [accordion] Bitbucket
>
> Gitar approves the PR on Cloud and Data Center. Bitbucket Cloud has no auto-merge to arm. On Data Center, Gitar merges the PR itself once Bitbucket's merge checks pass.

## Revocation

Each new review checks the current PR against the current criteria. On GitHub, resolving finding threads can trigger another approval evaluation without a push once the review is eligible. The dashboard shows **Re-evaluating** while that check runs.

If Gitar integrates other commits while pushing a fix, it requires a fresh review before auto-approving the updated branch.

If a new push introduces blocking findings, Gitar revokes its previous approval:

* On GitHub, Gitar dismisses its approving review.
* On GitLab, Gitar calls the unapprove API.
* On Azure DevOps, Gitar clears its approval vote.
* On Bitbucket, Gitar removes its approval.
* Gitar also attempts to [cancel auto-merge it enabled](https://docs.gitar.ai/features/code-review/auto-merge.md#when-approval-is-revoked).

If the `gitar-approved` label was applied, Gitar removes it when the approval is revoked.

> [!NOTE]
>
> If Gitar cannot complete approval evaluation, it skips approval for that run.


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