# Configuring GitHub WebHooks

Now we need to configure webhook-url on [backend](https://github.com/openshift-pipelines/vote-api) and [frontend](https://github.com/openshift-pipelines/vote-ui) source code repositories with the Route we exposed in the previously.

* Run below command to get webhook-url

```
echo "URL: $(oc  get route el-vote-app --template='http://{{.spec.host}}')"
```

> ***Note:***
>
> Fork the [backend](https://github.com/openshift-pipelines/vote-api) and [frontend](https://github.com/openshift-pipelines/vote-ui) source code repositories so that you have sufficient privileges to configure GitHub webhooks.

#### Configure webhook manually

Open forked github repo (Go to Settings > Webhook) click on `Add Webhook` > Add

```
echo "$(oc  get route el-vote-app --template='http://{{.spec.host}}')"
```

to payload URL > Select Content type as `application/json` > Add secret eg: `1234567` > Click on `Add Webhook`

![Add webhook](https://github.com/openshift/pipelines-tutorial/raw/master/docs/images/add-webhook.png)

* Follow above procedure to configure webhook on [frontend](https://github.com/openshift-pipelines/vote-ui) repo

Now we should see a webhook configured on your forked source code repositories (on our GitHub Repo, go to Settings>Webhooks).

![Webhook-final](https://github.com/openshift/pipelines-tutorial/raw/master/docs/images/webhooks.png)

***Great!, We have configured webhooks***

**Trigger pipeline Run**

When we perform any push event on the [backend](https://github.com/openshift-pipelines/vote-api) the following should happen.

1. The configured webhook in vote-api GitHub repository should push the event payload to our route (exposed EventListener Service).
2. The Event-Listner will pass the event to the TriggerBinding and TriggerTemplate pair.
3. TriggerBinding will extract parameters needed for rendering the TriggerTemplate. Successful rendering of TriggerTemplate should create 2 PipelineResources (source-repo-vote-api and image-source-vote-api) and a PipelineRun (build-deploy-vote-api)

We can test this by pushing a commit to vote-api repository from GitHub web ui or from terminal.

Let’s push an empty commit to vote-api repository.

```
git commit -m "empty-commit" --allow-empty && git push origin master
...
Writing objects: 100% (1/1), 190 bytes | 190.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To github.com:<github-username>/vote-api.git
   72c14bb..97d3115  master -> master
```

Watch OpenShift WebConsole Developer perspective and a PipelineRun will be automatically created.

![pipeline-run-api](https://github.com/openshift/pipelines-tutorial/raw/master/docs/images/pipeline-run-api.png)
