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

# GitHub

> Install the Arch GitHub App so Arch can read your repositories, workflows, dependencies and security alerts.

## Before you start

You need to be an owner of the GitHub organization whose repositories Arch reads, or a repository admin for
only the repositories you administer, unless an owner has turned that off. Any other member can only send
the owner a request, and Arch cannot finish the connection from a request. The app manager role does not allow you
to install the app.

## Setup steps

1. In Arch, add the GitHub connection. Arch opens GitHub's page to install the Arch GitHub App. See
   [Installing a GitHub App from a third party](https://docs.github.com/en/apps/using-github-apps/installing-a-github-app-from-a-third-party).
2. Select the organization where you want to install the app.
3. Select All repositories, or select Only select repositories and choose the repositories in the Select
   repositories dropdown.
4. Review the permissions the app requests. They are listed under Permissions below.
5. Click Install. If the button says Install and request or Request, an organization owner must install the app
   instead.
6. If GitHub asks you to authorize the Arch GitHub App, authorize it. Arch uses this only to check that you are the
   person who installed the app. See
   [Authorizing GitHub Apps](https://docs.github.com/en/apps/using-github-apps/authorizing-github-apps).
7. GitHub returns you to Arch. You now hold an installation of the Arch GitHub App, and you choose its repositories
   and modules under Configure.

## Fields

| Field | What to enter |
| - | - |
| None | You do not enter a credential. Arch signs in as the Arch GitHub App that you install in Setup steps. |

You do not enter an address, a token or a key.

## Permissions

| Permission | What Arch reads with it |
| - | - |
| Metadata: Read-only | Each repository's details, its branches and the rules in force on each branch. GitHub grants it to every app. |
| Contents: Read-only | Each repository's source and change history, and its dependency graph. |
| Pull requests: Read-only | Each repository's source and change history. |
| Actions: Read-only | Each repository's workflows and deployment environments. |
| Dependabot alerts: Read-only | Each repository's Dependabot alerts. |
| Code scanning alerts: Read-only | Each repository's code scanning alerts. |
| Secret scanning alerts: Read-only | Each repository's secret scanning alerts and where each secret was found. |

Arch asks only for read access. To check the permissions or change which repositories the app can reach, open your
organization's Settings, select GitHub Apps under Third-party Access, and click Configure next to the Arch GitHub
App. Under Repository access, choose the repositories, then click Save. See
[Reviewing and modifying installed GitHub Apps](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps).

## Configure

| Step | What to choose |
| - | - |
| Select Repositories | The repositories Arch reads. Arch lists the repositories the app can reach. |
| All repositories the App can access | Choose it to read every repository the installation reaches, including repositories you add to the app later. |
| Select Modules | The GitHub data Arch collects for the selected repositories. Choose at least one. |
| Source and change history | Repositories, branches and the rules on each branch. Needs Metadata, Contents and Pull requests. |
| Workflow automation | Workflows and deployment environments. Needs Actions. |
| Dependency composition | The packages each repository depends on, from GitHub's dependency graph. Needs Contents. |
| Dependabot alerts | Known vulnerabilities in the repository's dependencies. Needs Dependabot alerts. |
| Code scanning alerts | Code weaknesses that code scanning found. Needs Code scanning alerts. |
| Secret scanning alerts | Secrets that secret scanning found in the repository. Needs Secret scanning alerts. |

## Sign-in

Arch signs in as the Arch GitHub App and asks GitHub for a short-lived token for your installation. When the sign-in
works, the connection test goes on to list the repositories the installation reaches, and checks that each selected
module can be read for each selected repository.

If the sign-in fails, check that the Arch GitHub App is still installed and not suspended. Open your organization's
Settings, select GitHub Apps under Third-party Access, and click Configure next to the Arch GitHub App. If it is
suspended, click Unsuspend. If it is not listed, add the GitHub connection again in Arch and install the app. See
[Reviewing and modifying installed GitHub Apps](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps).

## Test answers

A passing test lists each selected repository with each selected module that Arch can read. A module that GitHub has
turned off for a repository shows as unavailable and does not fail the test.

| Message | What it means and what to do |
| - | - |
| Some selected repository and module pairs are not authorized. | The app lacks a permission a selected module needs. Grant the missing permissions to the Arch GitHub App, then test the connection again. |
| This installation grants access to no repositories. | The installation reaches no repository you selected. Grant the Arch GitHub App access to at least one repository, then test the connection again. |
| Access could not be confirmed for some selected repository and module pairs. | GitHub did not answer conclusively. Test the connection again in a few minutes. |
| Arch reached its own concurrency limit before every pair was checked. | Too many checks are running in Arch right now. Test the connection again in a moment. |
| The check did not finish inside its time budget. | GitHub is responding slowly. Test the connection again in a few minutes. |
| GitHub refused the App credentials for this installation. Reinstall the Arch GitHub App. | GitHub no longer knows the installation, for example because the app was uninstalled. Add the GitHub connection again in Arch and install the app. |
| GitHub refused this installation's permissions. Review the App's repository access and try again. | GitHub refused the installation. Check the app's repository access under Configure in GitHub, then try again. |
| This connection is not bound to a GitHub installation. Reinstall the Arch GitHub App. | The connection holds no installation. Add the GitHub connection again in Arch and install the app. |
| This connection signed in to a GitHub deployment this environment no longer offers. Reconnect GitHub. | The connection was made to a GitHub that Arch no longer reaches. Add the GitHub connection again. |
| This deployment has no GitHub App configured. Contact your Arch administrator. | Arch has no GitHub App to sign in with. Contact Arch support. |
| GitHub is rate-limiting this installation. Retry in a few minutes. | GitHub limits how many requests the installation makes each hour. Try again in a few minutes. |
| GitHub is busy or rate-limiting this installation. Retry in a few minutes. | GitHub is busy or limiting requests. Try again in a few minutes. |
| GitHub could not be reached. Retry in a few minutes. | Arch could not reach GitHub or could not read its answer. Try again in a few minutes. |
| GitHub could not be reached. Retry the installation in a few minutes. | Arch could not reach GitHub while you installed the app. Add the GitHub connection again in a few minutes. |
| GitHub returned an unexpected error. Retry the installation in a few minutes. | GitHub answered the installation with an error. Add the GitHub connection again in a few minutes. |
| GitHub rejected the App credentials. Check the App id, private key, client id and client secret. | GitHub refused Arch's own app credentials. Contact Arch support. |

## Limits

* Arch brings in, for each selected repository and module: repositories, branches and branch rules, workflows and
  deployment environments, dependency manifests, lockfiles and packages, Dependabot alerts, code scanning alerts and
  secret scanning alerts.
* Code ownership and repositories the app cannot reach are not brought in.
* Arch reads the data once a day by default. You can choose every hour, every 3, 6 or 12 hours, or once a day.
* Each run reads every selected repository and module again.
* One installation of the Arch GitHub App connects to Arch once. You can choose up to 500 repositories by name;
  when the app reaches more, choose All repositories the App can access.


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