# GitHub Enterprise

See all your teams work from JIRA issues to pull requests in once place by integrating Github with Haystack.

{% hint style="info" %}
For more information on what data Haystack uses from Git, [here is an article!](https://help.usehaystack.io/admin/security-and-privacy)
{% endhint %}

### For GitHub Enterprise (GHE) integrations, there are 5 high-level steps <a href="#h_d1b5377f79" id="h_d1b5377f79"></a>

1. **Open GHE firewall to Haystack IPs**
2. **Create the Haystack Github App**
3. **Generate App secrets**
4. **Install organization to the newly created GitHub App**
5. **Provide Haystack with the App secrets**

You can find detailed instructions on each step below.

### 1. Open GHE firewall to Haystack IPs <a href="#h_f97bf30913" id="h_f97bf30913"></a>

Haystack API uses the following IP addresses to connect to GHE.

```
35.209.159.249
35.208.83.132
35.208.18.170
35.209.170.63
```

For Haystack to access your servers, we'll need open firewall access to the given IPs.

### 2. Create the Haystack GitHub App <a href="#h_32118d1dc1" id="h_32118d1dc1"></a>

Open the organization you want Haystack to access, and go to the **Settings** page. Then, go to **GitHub Apps** in the **Developer Settings.**

<figure><img src="https://haystack-cf20ab244ac6.intercom-attachments-1.com/i/o/340840463/32b213a361ea0760aff4f6dd/7006b94e1988e0a153d09b8b03ac0738.png" alt=""><figcaption></figcaption></figure>

Click New GitHub App.

<figure><img src="https://athenian.intercom-attachments-7.com/i/o/325951393/6b640dc7527b8e0b2d750e51/Yx6UeRRs4OwJuqbgx924WckYWmDvTAiaLzgofBYa0DhZgjQrRqJqiEP6V95R52GmqnaqQUEMTUZFVSkRzzc2JfL02JnqcsVfdzrnxlbsKyB1XcF6EgN_GSiOr6ZOWxUUmC1U8t3W?expires=1621361372&#x26;signature=5aa87073b5f71fafc6f3acbd0774eab0d3ef4c9032620540b8e4db14189ed83a" alt=""><figcaption></figcaption></figure>

Here, fill in the following fields according to the detail below:

### Register new GitHub App <a href="#h_a1bb873d89" id="h_a1bb873d89"></a>

* **GitHub App name**: Haystack Enterprise
* **Homepage URL**: [https://dash.usehaystack.io](https://dash.usehaystack.io/)
* **User authorization callback URL**: <https://dash.usehaystack.io/onboarding/github-enterprise/complete>

  <figure><img src="https://downloads.intercomcdn.com/i/o/897667636/0687f7a179aeeb2264787bf3/Screenshot+2023-12-01+at+00.50.39.png" alt=""><figcaption></figcaption></figure>

### Webhook <a href="#h_af924b51e8" id="h_af924b51e8"></a>

* **Active**: ✅
* **Webhook URL**: <https://webhooks.usehaystack.io/integrations/vcs/github-enterprise>
* **Webhook secret**: Generate one using (*make sure to store this securely*)

  ```
  openssl rand -base64 500 | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n 1
  ```

<figure><img src="https://downloads.intercomcdn.com/i/o/340825279/e39fa08718d8936772f3e688/image.png" alt=""><figcaption></figcaption></figure>

### Permissions <a href="#h_9901cdbadb" id="h_9901cdbadb"></a>

Haystack requires the following permissions to give you insights. These permissions are in **read-only** mode:

*Repository permissions:*

* **Actions**
* **Administration**
* **Checks**
* **Contents**
* **Deployments**
* **Issues**
* **Metadata**
* **Pages**
* **Pull requests**
* **Webhooks**
* **Projects**
* **Commit statuses**
* **Dependabot alerts**

*Organization permissions:*

* **Members**
* **Administration**
* **Webhooks**
* **Plan**
* **Projects**
* **Blocking users**
* **Team discussions**

*User permissions:*

* ***No access to all***
* Commit comment

### Subscribe to events <a href="#h_97b7797d44" id="h_97b7797d44"></a>

Check the following items

| <ul><li><strong>Meta</strong></li><li><strong>Check suite</strong></li><li><strong>Create</strong></li><li><strong>Deployment key</strong></li><li><strong>Fork</strong></li><li><strong>Issue comment</strong></li><li><strong>Label</strong></li><li><strong>Member</strong></li><li><strong>Page build</strong></li><li><strong>Project card</strong></li><li><strong>Public</strong></li><li><strong>Pull request review</strong></li><li><strong>Push</strong></li><li><strong>Repository</strong></li><li><strong>Status</strong></li><li><strong>Team add</strong></li><li><strong>Org block</strong></li></ul> | <ul><li><strong>Security advisory</strong></li><li><strong>Check run</strong></li><li><strong>Delete</strong></li><li><strong>Deployment</strong></li><li><strong>Deployment status</strong></li><li><strong>Gollum</strong></li><li><strong>Issues</strong></li><li><strong>Milestone</strong></li><li><strong>Membership</strong></li><li><strong>Organization</strong></li><li><strong>Project</strong></li><li><strong>Project column</strong></li><li><strong>Pull request</strong></li><li><strong>Pull request review comment</strong></li><li><strong>Release</strong></li><li><strong>Repository dispatch</strong></li><li><strong>Star</strong></li><li><strong>Team</strong></li><li><strong>Watch</strong></li></ul> |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

In the final step, make sure to select **Any account** and click **Create Github App**:

<figure><img src="https://downloads.intercomcdn.com/i/o/340829550/78716b7a9c8119378a693ac5/image.png" alt=""><figcaption></figcaption></figure>

### 3. Generate App secrets <a href="#h_d3200909f2" id="h_d3200909f2"></a>

Take notes on the following items in a secure place.

* **App ID**
* **Client ID**
* **Client secret**
* **Public link**
* **Webhook Secret** (generated in the previous step)
* **Private Key**

<figure><img src="https://downloads.intercomcdn.com/i/o/340832452/298298d5d296c613485f9190/image.png" alt=""><figcaption></figcaption></figure>

On the same page, go to the Private keys section and press **Generate a private key**.

<figure><img src="https://downloads.intercomcdn.com/i/o/340832652/4ea42e214767500477bc02a2/image.png" alt=""><figcaption></figcaption></figure>

### 4. Install organization to the newly created GitHub App <a href="#h_ac5fec8730" id="h_ac5fec8730"></a>

We have created a GitHub App. Now we should allow the app to have access to the organizations you'd like to get insights.

On the left bar, go to **Install App** and press the **Install** button for the organizations you want Haystack to have access to.

*Note: You can install one or more organizations.*

<figure><img src="https://downloads.intercomcdn.com/i/o/340837328/98d9c73fbf2cc1fd9820f40d/image.png" alt=""><figcaption></figcaption></figure>

Afterward, select the repositories you'd like to get insights into and press **Install**.

<figure><img src="https://downloads.intercomcdn.com/i/o/340837507/5c279bb62b48e7d3865679ea/image.png" alt="" width="563"><figcaption></figcaption></figure>

### 5. Provide Haystack with the App secrets <a href="#h_8e34ce7fe5" id="h_8e34ce7fe5"></a>

<figure><img src="https://downloads.intercomcdn.com/i/o/907329574/e686d1157836a92121aa0547/Screenshot+2023-12-12+at+6.43.22%E2%80%AFPM.png" alt="" width="563"><figcaption></figcaption></figure>

Finally, copy over the following information from the above steps into Haystacks integration form.

* **App ID**
* **Client ID**
* **Client secret**
* **Public link**
* **Webhook Secret**
* **Private Key**

You have installed Haystack on your GitHub Enterprise organization successfully!
