# From Github events

Suppose you want to trigger a pipeline or release on a successful PR merge on GitHub or when a code is pushed to a particular branch, they can create a webhook using the webhook type as GitHub.

### **Steps to create a Github Webhook for release** <a href="#steps-to-create-a-github-webhook-for-release" id="steps-to-create-a-github-webhook-for-release"></a>

**Pre-requisites:**

* An active GitHub account with repositories needs to have the PAT(Personal Access Token) which can be entered while creating GitHub integrations
* An Active cluster
* A Release that has been created from the Release Templates section

&#x20;

**Steps**

1. On click of the **create webhook** button, a modal window appears in which you can enter the details for webhook creation

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FQ4416W5x8loGeWLUjcGE%2Fimage-20240416-115100.png?alt=media&#x26;token=f236b862-7d23-4433-bd14-12df12ece760" alt=""><figcaption></figcaption></figure>

2. Now we need to select the Webhook Type as Github from the **Webhook Type** dropdown

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FB5h5udG3p1I9x66roYMK%2Fimage-20240416-115235.png?alt=media&#x26;token=0fc4383f-b708-41af-b1c0-9d957ac42cc4" alt=""><figcaption></figcaption></figure>

3. After selecting the webhook type as **Github**, a dropdown will be shown to select the repository for which the webhook needs to be created

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F4lhLqvgCR1kcG3yCbD9p%2Fimage-20240417-063646.png?alt=media&#x26;token=0738fcc3-983e-42d1-8851-792e8b5efbe0" alt=""><figcaption></figcaption></figure>

&#x20;

4. Once the repository has been selected, users have the option to select the event for which they want the pipeline or release to be triggered\
   Ozone offers **2 events** for which webhooks can be created:\
   \- Push branch - whenever code is pushed to the **specified branch** the webhook is triggered\
   \- Pull request - whenever a pull request is merged at that point the webhook will be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FcR5MRF4CxNQ1xkP6ryPp%2Fimage-20240417-064152.png?alt=media&#x26;token=1f262abd-8355-4bf5-984d-7cdc61530db8" alt=""><figcaption></figcaption></figure>

&#x20;

5. After selecting the event, users are provided an option to **select the branch** for the repository for which they want the webhook to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FCvm72BJaZ37eGGSasXGK%2Fimage-20240417-092701.png?alt=media&#x26;token=40854af8-05d1-478f-a699-4d4671ce1fdc" alt=""><figcaption></figcaption></figure>

6. Once the branch has been selected, the next option is provided for the users to select as to whether they want to trigger a **release** or a **pipeline** on the successful happening of the event that they had selected

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2Fs4uEnkYoMxcjv2VcjteF%2Fimage-20240417-092856.png?alt=media&#x26;token=e73c4458-b375-4602-9447-c0f2b89e3d9b" alt=""><figcaption></figcaption></figure>

Here we will select the option of **Release**

7. After this users can select the release which they want to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FxO9PPlT2Ml8oRly5heXk%2Fimage-20240417-093015.png?alt=media&#x26;token=d554c34b-8b22-4543-84fe-2dd2c86e19ec" alt=""><figcaption></figcaption></figure>

8. Once every option has been selected the **map parameters** option will be enabled and users can click on it to move to the next step

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FN3EYsac0hS2n3nSGYUra%2Fimage-20240417-093255%20(1).png?alt=media&#x26;token=337c2d8a-2621-4d0c-b631-a75ce4f88eb1" alt=""><figcaption></figcaption></figure>

&#x20;9\. After going to the second step users can choose the **input run parameters**, once all these options have been selected, users can click on the save button to create the webhook

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F07RSRRjKpAuSPyPmljt5%2Fimage-20240417-094528.png?alt=media&#x26;token=19a95c3a-d70b-4b9c-8e88-5f5e2269b7d3" alt=""><figcaption></figcaption></figure>

10. Once the webhook has been created, it will be shown in the tabular list view

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FyfYJSWxbh7jr0NV2gfWo%2Fimage-20240417-101236.png?alt=media&#x26;token=f91050f8-5c63-430f-9067-471eea8df663" alt=""><figcaption></figcaption></figure>

\
Here you can see it shows when was the webhook last triggered, as well as we can enable/disable the webhook from the tabular list, and we can click on the edit icon to edit the webhook.

### **Steps to create webhook for pipeline** <a href="#steps-to-create-webhook-for-pipeline" id="steps-to-create-webhook-for-pipeline"></a>

**Pre-requisites:**

* An Active cluster
* A microservice

Follow the same steps until **Step 5** of Creating Webhooks for release

**Steps:**

1. Once the repository name and the branches have been selected select the trigger type as **Pipeline**

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FLOKZO9JiJnPfxZcjnTCY%2Fimage-20240417-110814.png?alt=media&#x26;token=c9e8343b-5429-452a-bf3e-8c88a255e54d" alt=""><figcaption></figcaption></figure>

2. Once the Trigger type has been selected, now select the pipeline that needs to be triggered

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FZQD0cb6OHp8tVsi6qKJ6%2Fimage-20240417-111223.png?alt=media&#x26;token=03b67b54-728c-47b6-82cb-29355a3145e0" alt=""><figcaption></figcaption></figure>

&#x20;

3. After selecting the pipeline, select the environment in which the webhook needs to be created\
   **Remember to select the environment the same in which the cluster has been created**

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FGOXpu4CZVzkNYe9PzKhe%2Fimage-20240417-111439.png?alt=media&#x26;token=c854dc61-b2df-449c-94da-ec9db04aeb80" alt=""><figcaption></figcaption></figure>

4. After selecting the environment, users will be shown an option to select the cluster<br>

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FZGn15xoxWZc1tKWXQntx%2Fimage-20240417-111524.png?alt=media&#x26;token=5e26abe6-2ac9-4a62-89d9-3205f1787df0" alt=""><figcaption></figcaption></figure>

5. Once the cluster has been selected, select the microservice

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FFgS2EKJYK5pSeigxcAI7%2Fimage-20240417-111734.png?alt=media&#x26;token=e1c1ac42-52c1-4ff0-9c91-8ea123c59037" alt=""><figcaption></figcaption></figure>

&#x20;6\. After selecting the microservice, users can move to the **Map parameters** step, to select the run parameters for the pipeline<br>

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F14VjiyL3Rzie4dLyJ7TT%2Fimage-20240417-112014.png?alt=media&#x26;token=0c3dd5ae-dbb6-4288-9890-414a2dedceab" alt=""><figcaption></figcaption></figure>

7\. In **Map parameters,** users can select all the options as they desire.

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2Fow1rygYM8E8uaDtTEGIF%2Fimage-20240417-111734.png?alt=media&#x26;token=177b614b-caae-4a5c-b06c-3ce59c355b5d" alt=""><figcaption></figcaption></figure>

8\. Once all this is done, users can click on the **Save** button to create the webhook for the pipeline.<br>

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2FLLUeslG9oIqnh9nxAAIp%2Fimage-20240417-112355.png?alt=media&#x26;token=f06147f9-601f-45f3-86df-b64577e4a1e2" alt=""><figcaption></figcaption></figure>

\ <br>

9\. The created webhook will be shown in the webhook list view

<figure><img src="https://3829750647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FAObcOkMb6sCSnSdcUOTm%2Fuploads%2F5h3tRWVxI7i6NWcm8g5P%2Fimage-20240417-112452.png?alt=media&#x26;token=1645fd64-aafd-459d-9b3c-ab03ff840165" alt=""><figcaption></figcaption></figure>

Users can click on the edit icon to edit the webhook, and click on the toggle button to **enable/disable** the webhook.\ <br>

Hurray 🥳This is how you can create the webhooks for GitHub to trigger a release or a pipeline.
