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

# GitHub Integration

> What the Agent Golf GitHub App reads from your repositories, what Agent Golf stores and for how long, and what it writes.

The Agent Golf GitHub App sends Agent Golf the pull requests, reviews, comments, and CI runs of the repositories that you choose. Agent Golf uses them to cost each pull request and link it to agent sessions, and writes nothing to your repositories or pull requests.

Your GitHub organization sends pull-request, review, comment, push, and CI events to Agent Golf through the Agent Golf GitHub App. Agent Golf records pull requests and shows their linked sessions.

The Agent Golf GitHub App sends pull request, review, comment, push, and CI events to Agent Golf. Agent Golf makes
every GitHub call. GitHub never connects to Uplink.

To install the App and connect your GitHub organization, see [Connect a GitHub Organization](https://docs.agent.golf/github/organization.md).

## What Agent Golf reads

Agent Golf uses these GitHub events of the repositories that you choose:

* **Pull requests**: opened, updated with new commits, edited, marked ready or draft, closed, merged, and reopened. For each event, the App also reads the commits, the changed files, and the diff of the pull request.
* **Reviews and comments**: reviews, inline review comments, review threads, and comments on pull requests. Agent Golf also keeps comments on commits and on discussions.
* **Pushes**: the pushed commits and their authors, also for a push without a pull request.
* **CI**: GitHub Actions workflow runs and workflow jobs. Agent Golf uses them for the CI runs of each pull request and their cost.
* **Repositories and installation**: added, removed, created, deleted, renamed, and transferred repositories, and changes to the App installation. Agent Golf uses them to keep the repository list and the connection state current.

Agent Golf keeps the other events that GitHub sends for a short time, and does not use them. See [What Agent Golf stores](#what-agent-golf-stores).

### App permissions

GitHub shows every permission of the App when you install it. These permissions change what you see in Agent Golf:

| Permission | What it gives |
| - | - |
| **Actions: Read** | The CI runs of each pull request and their cost. An owner of the GitHub organization must approve it. See [Approve Actions access](https://docs.agent.golf/github/organization.md#approve-actions-access). |
| **Members: Read** (organization) | Agent Golf checks that the person who connects the GitHub organization is a current owner of it. Without it, the connection stops with **GitHub App Permissions Required**. |
| **Contents: Read** | The source of a file on the **Code** page. See [Source on the Code page](#source-on-the-code-page). |

## What Agent Golf stores

Agent Golf stores this GitHub data in its cloud:

| Data | Contents |
| - | - |
| GitHub events | Each webhook as GitHub sends it. |
| Pull request reads | The pull request, its commits, its changed files, and its diff, as the App reads them for an event. |
| Pull requests and CI runs | Each pull request with its title, description, state, times, and author, its changed files, its reviews and comments, the commit authors, and the CI runs. |

For how long Agent Golf keeps each kind of data, see [Data Retention](https://docs.agent.golf/account/data-retention.md#what-stays-and-for-how-long).

The organization holds the GitHub data of its GitHub organizations, and every workspace of the organization sees it. See [Connect your organization](https://docs.agent.golf/github/organization.md#connect-your-organization).

### Changed lines of merged pull requests

For rework and the **Code** page, Agent Golf stores, for each merged pull request, the changed file paths, the changed line ranges, and a short digest of each changed line. A digest is not the text of the line. Agent Golf stores no source text for this feature.

### Source on the Code page

To show the source of a file on the **Code** page, Agent Golf reads the versions of that file from GitHub with the App. It reads only the versions of the pull requests that changed the file in the selected period, and only when a user with the **View Source Code** permission opens the file. The text passes through Agent Golf for that request. Agent Golf does not store it or log it.

The GitHub repository access of the user does not apply to this view. An administrator controls it with the **View Source Code** permission. See [Default roles](https://docs.agent.golf/account/users.md#default-roles).

### Classification

Agent Golf sends some pull request data to TypeSafe, its classification provider:

* To find the intent of a pull request, for example a bug fix, Agent Golf sends its title, its description, its changed-file list, and its diff.
* To decide if a pull request fixes or finishes earlier work, Agent Golf sends the titles and descriptions of the two pull requests, and the diff at the shared paths.

Agent Golf keeps the answers. It does not log what it sends.

## What Agent Golf writes

Agent Golf writes nothing to your pull requests. It posts no comment, review, check, or status.

## One GitHub organization, one Agent Golf organization

A GitHub organization connects to one Agent Golf organization at a time. After an admin disconnects it, another Agent Golf organization can connect it. Past data stays with the organization that collected it.

## Personal GitHub accounts

Each user can link a personal GitHub account, so that Agent Golf matches the pull requests of that account to them. See [Link Your GitHub Account](https://docs.agent.golf/github/personal-account.md).

## GitHub never reaches Uplink

GitHub sends events only to Agent Golf, and Agent Golf makes every GitHub call. GitHub never connects to Uplink, and Uplink never calls GitHub.

## Next steps

* [Connect a GitHub Organization](https://docs.agent.golf/github/organization.md)
* [Link Your GitHub Account](https://docs.agent.golf/github/personal-account.md)


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