# GitHub App for On-Prem

On-Prem installation requires a GitHub App. This page describes how to create one for your on-prem setup.

## Prerequisite

* You need to have the privilege to create a GitHub App and authorize the app for your repositories.
* A domain name that will be used for your on-prem installation.

## Variable definitions

`$GITHUB_URL`: Hostname where GitHub is hosted

`$AV_HOSTNAME`: Hostname where Aviator is hosted (e.g. `aviator.example.com`)

`$GITHUB_APP_ID`: ID generated when a GitHub app is created

`$MERGEQUEUE_PEM_FILE`: Private key generated by GitHub for Aviator

## Steps

### Step 1

Go to GitHub Developer settings and Click “New GitHub App”.

<figure><img src="https://273246003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAPqUQVbLbsfI5YESl32%2Fuploads%2F4cISCSeb2uJ84YEk5fsc%2Fimage.png?alt=media&#x26;token=92b72144-da4e-4850-b1fd-e9051c5c831e" alt=""><figcaption><p>Click Developer settings on the Settings page</p></figcaption></figure>

<figure><img src="https://273246003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAPqUQVbLbsfI5YESl32%2Fuploads%2FlfxUCXXN3loyg0f2p8hL%2Fimage.png?alt=media&#x26;token=952d82c5-97e0-4977-9682-0ac27262400f" alt=""><figcaption><p>Click New GitHub App button</p></figcaption></figure>

The developer settings can be found through your user settings or url of the format:`https://$GITHUB_URL/settings/apps`

Use the following settings to create the app:

**GitHub App name:** Aviator

**Description:** Automate merge workflows for GitHub, manage queues in teams and improve code quality.

**Homepage URL:** [<mark style="color:blue;">https://aviator.co/</mark>](https://aviator.co/)

**Callback URL:** `https://$AV_HOSTNAME/login/oauth/callback/github`

**Expire user authorization tokens**: YES

**Request user authorization (OAuth) during installation**: NO

**Enable Device Flow**: NO

**Setup URL:** `https://$AV_HOSTNAME/api/setup/complete`

**Redirect on update**: YES

**Webhook**

**Active**: YES

**Webhook URL:** `https://$AV_HOSTNAME/api/webhook`

**Webhook Secret:** Optional. If you setup Webhook secret, you should also define set that at `GITHUB_WEBHOOK_SECRET` to validate webhook signature.

**Permissions:**

{% hint style="warning" %}
***Please review the following carefully, any mismatch here could result in unexpected behavior of the app.***
{% endhint %}

Repository permissions

<table><thead><tr><th width="364">Name</th><th>Access</th></tr></thead><tbody><tr><td>Administration</td><td>Read-only</td></tr><tr><td>Checks</td><td>Read and write</td></tr><tr><td>Commit statuses</td><td>Read-only</td></tr><tr><td>Contents</td><td>Read and write</td></tr><tr><td>Issues</td><td>Read and write</td></tr><tr><td>Metadata</td><td>Read-only</td></tr><tr><td>Pull requests</td><td>Read and write</td></tr><tr><td>Workflows</td><td>Read and write</td></tr></tbody></table>

Organization permissions

| Name    | Access    |
| ------- | --------- |
| Members | Read-only |

**Subscribe to events**:

Check the following

* Branch Protection rules
* Check Run
* Check Suite
* Issue Comment
* Label
* Member
* Membership
* Public
* Pull request
* Pull request review
* Pull request review comment
* Pull request review thread
* Push
* Repository
* Status
* Team
* Workflow run

**Where can GitHub App be installed**: Any account

After creating the GitHub app, you can add a logo. Find a copy of Aviator Logo in the attached assets.

### Step 2

From the GitHub app page for Aviator, take a note of the App ID specified on the top. This is your `$GITHUB_APP_ID`.

![](https://273246003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAPqUQVbLbsfI5YESl32%2Fuploads%2F4pz7udv2jx5ByAb8lRVF%2Fscreenshot.png?alt=media\&token=26c29c28-36c0-45e3-922f-7b517ad31a64)

### Step 3

Generate a private key from the bottom of the page. This is your `$MERGEQUEUE_PEM_FILE`.
