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

# GitHub

> Connect GitHub for source context, fix PRs, postmortem PRs, and change-tracking issues

The GitHub integration gives sureops read access to your repositories for service ownership context and deployment correlation. It also underpins two separate write paths that each have their own configuration, not the Default Repository field below: **fix PRs** (when a diagnosis points to a code change as the root cause, the resolution specialist can open a draft PR reverting or patching it) and **postmortem PRs** (RCA documents opened as a PR against your knowledge base repo). See [What this integration enables](#what-this-integration-enables) for how each one is routed.

***

## What this integration enables

* **Repository context** — the contract ingestor reads `.sureops/services.yaml` and `.sureops/runbooks/` from your knowledge-base repo to understand service ownership and relevant runbooks. `catalog-info.yaml` can also be imported through the Backstage import flow — paste its URL or upload the YAML directly — rather than being auto-discovered from arbitrary service repos
* **Fix PRs** — for a code-change recommendation, sureops opens a draft PR against the specific service's repo before you approve, so you can review the diff; it's merged only after approval and closed if you reject. That repo is resolved from the service's `git_repo` (or `source.repo`, which takes precedence when both are set) in [`.sureops/services.yaml`](https://docs.sureops.ai/your-rules/services-yaml) — **not** the Default Repository field below. If a service has neither, the fix PR can't be opened for it.
* **Postmortem PRs** — sureops can open a PR with the RCA/postmortem document against your knowledge base repo. That repo comes from your org's Knowledge Base configuration (**Settings → Organization → Knowledge Base**) — also **not** the Default Repository field below. If no Knowledge Base repo is configured, the postmortem PR is silently skipped (logged, no error surfaced).
* **Deployment correlation** — agents can correlate recent commits and PR merges with incident timing during diagnosis
* **Change-tracking issues** — sureops files GitHub Issues as change-tracking records for incidents (when GitHub is selected as your change tracker). This is the one write path that actually reads the Default Repository field below.

***

## Prerequisites

* A GitHub organization where you have **Owner** or sufficient admin permissions to install a GitHub App

> [!NOTE]
>
> Integration connections are per-environment. A GitHub connection applies only to the environment it was set up for — it does not carry over to your other environments.

***

## Setup

GitHub connects through the **sureops GitHub App**. sureops runs the GitHub MCP server itself and authenticates every call with a short-lived token minted from your App installation — there's no MCP server for you to stand up and no personal access token to paste.

During the private beta, **sureops sets this connection up for you** rather than you connecting it from Settings:

* **Demo environment** — GitHub is connected automatically when the environment is provisioned. If you gave a GitHub username during onboarding, you'll get a collaborator invite to your sample-app fork; accept it to see the repo and the PRs agents open there. In the demo, sureops merges the PRs agents open for you either way — incident fix PRs only after you approve them, and Problem Record revert PRs, postmortem PRs, and runbook PRs as soon as they open. If a merge fails, the PR stays open for you. Two kinds are never merged by sureops: a Problem Record fix-plan PR, which stays open for your team to implement, and an incident fix PR containing newly written code, which always stays a draft for you to merge. See [Guided onboarding journey](https://docs.sureops.ai/onboarding/guided-onboarding-journey.md).
* **Your own environment** — contact [hello@sureops.ai](mailto:hello@sureops.ai) or your onboarding contact with the GitHub organization you want agents working in. We'll send you the sureops GitHub App install link; an owner of that organization approves it. As in the demo, sureops merges eligible agent PRs for you by default during the beta — see [Guided onboarding journey](https://docs.sureops.ai/onboarding/guided-onboarding-journey.md) to change that.

> [!NOTE]
>
> There is no GitHub connect form in **Settings → Environment → Integrations** during the private beta, and no MCP endpoint, token, or other credential for you to enter. Clicking **Details** next to GitHub there shows a notice that sureops sets GitHub up for you — email [hello@sureops.ai](mailto:hello@sureops.ai) to get it set up for the environment.

### After GitHub is connected: default repository (optional)

Once GitHub shows as connected, reopen it from **Settings → Environment → Integrations**. A **Settings** section appears below the connection status with a **Default Repository** field.

Format: `owner/repo` (for example, `acme/incidents`). This field is used **only** by the change-tracking issue feature — it does not affect fix PRs or postmortem PRs (see [What this integration enables](#what-this-integration-enables)). If left blank, GitHub still works for read-only context, but the moment an agent tries to file a change-tracking issue, that action fails loudly with a "missing repository" error rather than failing silently. Set this field if you want change-tracking issues to work.

Fix PRs and postmortem PRs have their own separate prerequisites: a fix PR needs the target service's repo declared via `git_repo` (or `source.repo`) in [`.sureops/services.yaml`](https://docs.sureops.ai/your-rules/services-yaml), and a postmortem PR needs a Knowledge Base repo configured under **Settings → Organization → Knowledge Base**. Neither reads this field.

***

## Common errors

| Error | Fix |
| - | - |
| GitHub shows "Connected" but agents never use repo context or open fix PRs — or a change-tracking issue fails with "GitHub integration is missing mcp\_endpoint or github\_app\_installation\_id" | The connection isn't fully set up through the sureops GitHub App (for example, an older connection saved without an App installation), so agents skip it. Settings shows an "Agent GitHub tools are off for this connection" notice on it. Contact [hello@sureops.ai](mailto:hello@sureops.ai) to have the App installed — the install updates the existing connection in place. |
| "GitHub tracker is missing a repository (expected `repo_full_name` as `owner/name`)" when filing a change-tracking issue | No **Default Repository** is configured. Set it under the GitHub integration's Settings section in Settings → Environment → Integrations, once connected. This only affects change-tracking issues — it's unrelated to fix PRs or postmortem PRs. |

***

## Official documentation

* [GitHub Apps documentation](https://docs.github.com/en/apps)
* [Managing GitHub App permissions](https://docs.github.com/en/apps/maintaining-github-apps/editing-a-github-apps-permissions)


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