# GitHub Integration

[<mark style="color:blue;">GitHub</mark>](https://github.com/) is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere.

You can use our GitHub integration to route details events from GitHub to the right users in Squadcast.

## How to integrate GitHub with Squadcast

### In Squadcast: Using GitHub as an Alert Source

1. Navigate to **Services** -> **Service Overview** -> select or search for your Service. Expand the accordion -> In the **Alert Sources** section, click **Add**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-4fbd74e7ca0b30173c47a1d58ed6a0804a0465aa%2FAlert_Sources.png?alt=media&#x26;token=aaca6610-9d18-4dd4-9cf5-320042f326f1" alt="How to configure GitHub integration in Squadcast"><figcaption><p>Step 1: Navigate to GitHub integration within a service</p></figcaption></figure>

2\. Select **GitHub**. Copy the displayed **Webhook URL** to [configure](#in-github-create-a-squadcast-webhook) it within **GitHub.** Finish by clicking **Add Alert Source** -> **Done**.

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-77495ee7d09e7c9a64db8a0f4530733777d8b88b%2FGitHub.png?alt=media&#x26;token=c128ede3-2fd2-4532-9f06-eccae99fa4e6" alt="Steps to add Github integration to a service in Squadcast"><figcaption><p>Step 2: Add GitHub as an alert source for a service</p></figcaption></figure>

{% hint style="warning" %}
**Important:**

When an alert source turns <mark style="color:green;">Active</mark>, it’ll show up under Configured Alert Sources. You can either generate a test alert from the integration or wait for a real-time alert to be generated by the Alert Source.\
\
An Alert Source is <mark style="color:green;">active</mark> if there is a recorded incident via that Alert Source for the Service.
{% endhint %}

### In GitHub: Create a Squadcast Webhook

You can configure a webhook for a group or a project.

1\. Click on your user icon on the top right. Under **Your repositories** or **Your organizations**, navigate to **Settings**

<div><figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-cf40a29fe9690ba83c06028824c6b259099f9484%2FGitHub_gb_1.png?alt=media" alt="How to configure a Squadcast Webhook in GitHub"><figcaption></figcaption></figure> <figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-5acbb06c2dc49a5ed0e51a5cf1fa067d92d37852%2FGitHub_gb_2.png?alt=media" alt="How to add a Webhook in Github"><figcaption></figcaption></figure></div>

2\. Under the **Webhooks** section, then select **Add webhook**

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-a29207122742f11e6e360f02961515cc57a374ae%2Fgithub_4.png?alt=media&#x26;token=714bf093-ec49-4e6a-87f6-f429ebacebc6" alt="How to add a Webhook in GitHub"><figcaption></figcaption></figure>

3\. Paste the previously copied Webhook from Squadcast into the **Payload URL** field, and select **Content type** as <mark style="color:red;">`application/json`</mark>

<figure><img src="https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-050f21fcaa3e0dee3f835203879ef78e0a013695%2Fgithub_5.png?alt=media&#x26;token=7ae18f03-b5ed-49ea-b67d-e79501082897" alt="Add a Payload URL and Content type in GitHub"><figcaption></figcaption></figure>

3\. In **Which events would you like to trigger this webhook** section, choose **Let me select individual events** and select the **below events** to trigger the Webhook. Next, click on **Add webhook**

* `Issues`
* `Pushes`
* `Pull Requests`
* `Releases`
* `Repository Vulnerability Alerts`

![Add the events for which your Webhook will get triggered](https://1574591692-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8TaWz01jmUJl58p4ZVel%2Fuploads%2Fgit-blob-f6b68c01d0b32180acbdfbfec53b7779d933a79f%2FGitHub_gb_4.png?alt=media)

{% hint style="info" %}
**Note:**

This integration supports the below GitHub events:

* `Issues` (Supports auto-resolution)
* `Pushes`
* `Pull Requests` (Supports auto-resolution)
* `Releases`
* `Repository Vulnerability Alerts` (Supports auto-resolution)
  {% endhint %}

That is it, you are good to go!

* Every time an Issue, Push, Pull Request, or Release event occurs in GitHub, an incident would be created in Squadcast.
* When an Issue or a Pull Request is closed in GitHub, the corresponding incident in Squadcast will be **automatically resolved** for it.
* However, for Pushes and Releases, users will have to manually resolve the associated incidents in Squadcast.

*Have any questions?* [*Ask the community*](https://community.squadcast.com/view/home)*.*
