# Link GitHub

Link a GitHub organization or personal account so its Actions jobs run on Sandcovery runners, and unlink it.

## Link a GitHub organization or personal account

An owner of your Sandcovery organization selects **Link to GitHub** on the [CI page](/app/ci), and GitHub asks them to authorize the Sandcovery CI GitHub App:

- Every GitHub organization that already installed the app, and whose self-hosted runners your GitHub account manages, is linked at once. So is your own personal GitHub account when it installed the app and the app holds the Administration permission on it.
- When there is none, GitHub opens the app's install page, which lists your personal account beside your organizations. Install it on one, and GitHub sends you back with that account linked, provided the app holds the permissions it needs there.

Only the owner of a personal GitHub account links it, so sign in to GitHub as that account before you choose **Link to GitHub**. When GitHub returns an installation on another person's personal account, the CI page says so and links nothing. An owner of a GitHub organization installs the app on it, and a GitHub account that manages the organization's self-hosted runners links it.

The app asks for the organization's self-hosted runners write, Actions read, and Metadata read permissions, and receives each `workflow_job` event. A personal account has no organization-level runners, so Sandcovery registers each runner of a personal account on the job's repository instead, which needs the app's Administration repository permission with read and write access. When GitHub asks you to accept the app's updated permissions, accept them under **Applications** in your GitHub settings.

Linking creates one API key for each GitHub organization or personal account, named `GitHub <account>`, and that account's runners start under it. The key has no limits until you set them on the [API Keys page](/app/keys). A personal account runs under the plan of the Sandcovery organization that links it.

GitHub then sends you back to the CI page, which lists each linked account under **GitHub installations**. The link holds only when:

- You come back in the same signed-in session within an hour of starting it.
- You are still an owner of the Sandcovery organization.
- For a GitHub organization, your GitHub account manages its self-hosted runners.
- For a personal account, it is your own GitHub account, and the app holds the Administration permission on it.
- No Sandcovery organization has linked that installation already.

Otherwise the CI page says which of these failed. When you are not an owner of the GitHub organization, GitHub sends your install request to its owners, and once one approves it, select **Link to GitHub** again. Once the link holds, set a job's `runs-on` to a Sandcovery slug, as [CI](/docs/ci#run-a-job-on-sandcovery) shows.

## Unlink an installation

An owner or admin unlinks an installation under **GitHub installations** on the [CI page](/app/ci), or with a management key through `DELETE /api/v1/ci/installations/{installation_id}`.

Jobs in that GitHub organization or personal account then start no more Sandcovery runners. A runner running a job ends with that job, an idle runner ends at once, and every runner ends at its TTL at the latest. Past jobs stay listed, and the GitHub App stays installed until you uninstall it on GitHub.
