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

# GitHub

> Connect repository context, PR monitoring and code fixes.

Connect GitHub to give Struct Agent repository context for investigations, PR monitoring and configured fixes. Inspect the installation and restrict setup to the repositories the person intends to use.

## Inspect access and existing connections

Use a claimed workspace with permission to configure connections.

```bash theme={null}
struct whoami --json
struct connections catalog github --json
struct connections list --json
```

Use the catalog's current fields, choices and permission requirements. Reuse an existing healthy connection instead of creating a duplicate.

## Connect with the CLI

Relay the `waiting_for_human` URL immediately while reading JSON Lines. The person approves the intended provider account in a browser signed in to Struct as the CLI user.

Replace example values with the intended resource:

```bash theme={null}
struct connect github --no-browser --json
```

After consent, choose the installation repositories and verify the default:

```bash theme={null}
struct github repos --json
struct github set-repo your-org/your-repo
```

Only select a repository the app can access. GitHub is needed for repository context and fixes, not for using Struct as standalone observability. See [monitoring](https://docs.struct.ai/agent/jobs/instrument-and-monitor.md) and [fixes](https://docs.struct.ai/agent/jobs/fix-issues.md).

## Verify and recover

Use the returned connection ID:

```bash theme={null}
struct connections show CONNECTION_ID --json
```

Inspect `health` and any missing access, not only the exit code. Struct has no saved-connection test for this app (`struct connections test` returns `test_not_supported`), so confirm access with the check below. If the approval link expired, start the connection command again and use the new link. Do not reconnect to a different account silently.

Connection health proves checked access; it does not prove an investigation or alert delivery.

Confirm that the repository you selected appears in `struct github repos --json`.

## Permissions

Install the Struct GitHub App on the repositories Struct should read and approve its requested permissions.

### Code and pull requests

Read code, open fix branches and pull requests, and review pull requests.

| Permission | Used for |
| - | - |
| `contents: write` | Reading code and pushing fix branches |
| `pull_requests: write` | Opening fix pull requests and posting reviews |
| `issues: write` | Assigning pull requests (GitHub assignees use the Issues API) |
| `metadata: read` | Listing repositories |
| `checks: read` | Reading CI results on Struct's pull requests |
| `actions: read` | Reading workflow runs and deployment environments |

### Deployments

Know when a change reached production, so Auto Monitors can verify the deploy.

| Permission | Used for |
| - | - |
| `deployments: read` | Also needs the Deployment statuses webhook event. Existing installations are asked to approve it once. |

### Repository webhooks

Add a deployment webhook to a repository. Only needed if you set up deploy detection that way.

Permissions: `repository_hooks: write`.

* Struct does not push to protected branches or merge.
* Struct receives these webhook events: pull requests, pull request reviews and review comments, issue comments, installations and deployment statuses.

Permission catalog version `2026-11-04.1`. See [permission changes](https://docs.struct.ai/reference/permission-changes.md).


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