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

# GitHub

Connect Datawise to GitHub to enable Schema Guardian. Once connected, Datawise analyzes pull requests in your connected repos, detects breaking schema changes, and posts a detailed bot comment with downstream impact and mitigation guidance.

## Prerequisites

* A GitHub account with admin access to the repositories you want to connect.
* At least one repository that contains dbt model code or SQL files that reference warehouse schemas.

## Connection Setup

Go to **Connectors**, click **Add Connector**, and select GitHub.

### OAuth Authorization

Clicking **Connect** redirects you to GitHub where you authorize the Datawise GitHub App. During authorization you can choose:

* **All repositories** — Datawise can access any repo in your organization.
* **Selected repositories** — Datawise only accesses repos you explicitly choose. Add more later from GitHub under **Settings > Applications > Authorized GitHub Apps**.

### Selecting Repos

After authorization, select which repositories Schema Guardian should monitor.

| Plan       | Repo limit |
| ---------- | ---------- |
| Starter    | 3          |
| Pro        | 10         |
| Enterprise | Unlimited  |

## How Schema Guardian Works

When a pull request is opened or updated:

1. Datawise fetches the PR diff from GitHub.
2. SQL and dbt model files are analyzed using AI to identify schema changes.
3. Breaking changes are classified: column removals, renames, type changes, breaking model restructures.
4. Downstream impact is resolved using your connected warehouse and dbt lineage.
5. A bot comment is posted in the PR with breaking changes, impacted assets, and mitigation recommendations.

The bot comment updates automatically on each new commit to the PR.

## Merge Protection

When enabled, Datawise posts a GitHub status check alongside the bot comment. If a breaking change is detected, the check returns `failure` and blocks the merge button.

Available on: **Pro and Enterprise**.

To enable:

1. Go to **Settings > Merge Protection** in Datawise.
2. Toggle on the repos where you want enforcement.
3. In GitHub, add `datawise/schema-guardian` as a required status check in your branch protection rules.

<Note>
  Admin users can override a blocked merge from the Schema Guardian view in Datawise.
</Note>

## Permissions

| Permission           | Reason                                      |
| -------------------- | ------------------------------------------- |
| Pull requests: Read  | Fetch PR diffs for analysis.                |
| Pull requests: Write | Post bot comments on PRs.                   |
| Checks: Write        | Create status checks for Merge Protection.  |
| Contents: Read       | Read dbt model and SQL files from the repo. |

## After Connecting

* Schema Guardian begins analyzing new pull requests in connected repos automatically.
* The **Schema Guardian** view shows all analyzed PRs, detected changes, and bot comment status.
* Historical PRs are not retroactively analyzed.
