# 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="/files/azy8NCj8aiqEZ4MNrayJ" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/PlUdOJMU8IcoW3kpZx4R" 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="/files/YOb5Mq2VcL9lCRlM7dIx" 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="/files/r8Bh6z1938sH9WNP63rW" 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="/files/IHuv0CR9lEF0UrKLFTcy" 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="/files/UjfudoWjSQ2s1hkSv4px" 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="/files/1a6B2GJNRnaeSJyCz9Wd" 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="/files/o8WzQG4Ea1NniBxPYEsA" 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="/files/iYMFm7dpq1GvDxslzxxt" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/OkeWgUv6EnTgsZuLVpBz" 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="/files/TDL9k5oTD0B6tJnWQkQl" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/RIXSjcQk7XpksmKRouVb" 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="/files/3phaQpALFt7pqfQrHV0g" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/7yu6bMeX1MvxWfG4ciKu" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/wtEUJgsLZbPsE9UEDvG9" 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="/files/2g9Gx30AB4V4FE0si1Ud" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/np9Afn8fZKaPYqCn1WyW" 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="/files/46q1qWZgTkXiXvHFdy6s" alt=""><figcaption></figcaption></figure>

\ <br>

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

<figure><img src="/files/KBcQmlRiJITNjj7Lp7rQ" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ozone.one/ozone-end-user-guide/documentation/ci-cd/triggers/triggering-a-pipeline-and-or-a-release-run/from-github-events.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
