Skip to main content

Manual setup of CI jobs and Pipeline webhooks in GitHub

How to create the GitHub webhooks Gearset Pipelines and CI jobs need by hand, when Gearset can’t add them automatically.

Written by David Martin

Gearset needs two webhooks in your GitHub repository: one to run your CI jobs and one for your Pipeline. Gearset normally creates both when you set up a Pipeline or CI job.

Use this article to create the GitHub webhooks yourself when Gearset can’t or you decide not to.

Note: Only users with the Admin role on a GitHub repository can create webhooks for it. If you don’t have Admin, send the payload URL and secret from Gearset to someone on your team who does.

How many GitHub webhooks does Gearset need?

Gearset needs one GitHub webhook for all CI jobs on a repository and one for the Pipeline, so a repository with one Pipeline has two Gearset webhooks. One webhook covers every CI job because Gearset pools them. When an event arrives, Gearset checks the event type, repository, and branch to decide which CI job to run.

The following table shows how to tell the two Gearset webhooks apart in GitHub by their payload URL.

Webhook

Payload URL contains

Pipeline webhook

/pipeline/ and your Pipeline ID

CI job webhook

/continuous-integration-job/

You set up both webhooks the same way in GitHub. Only the payload URL and secret differ. For more on pooling, see CI job and Pipeline webhooks.
​

Where do I find the payload URL and secret in Gearset?

Gearset shows the payload URL and secret for each GitHub webhook in a webhook setup modal.

  • Pipeline webhook: When you create a Pipeline, select Manually set up a webhook in the webhook step. For an existing Pipeline, click the Pipeline settings cog, then click Edit webhook.

  • CI job webhook: On the CI jobs page, open the CI job’s menu and select Webhook setup....

In the modal, expand the manual setup section to see the payload URL and secret.
​

How do I create a Gearset webhook in GitHub?

Create the Pipeline webhook and the CI job webhook in GitHub with the same steps. You need the Admin role on the repository.

  1. In GitHub, open the repository your Pipeline uses.

  2. Click Settings, then click Webhooks in the sidebar.

  3. Click Add webhook. As shown below.

  4. In Payload URL, paste the payload URL from the Gearset webhook modal.

  5. In Content type, select application/json.

  6. In Secret, paste the secret from the Gearset webhook modal.

  7. Under SSL verification, leave Enable SSL verification selected.

  8. Under Which events would you like to trigger this webhook?, select Let me select individual events. As shown below.

  9. Select Pushes and Pull requests.

  10. If you’re creating the Pipeline webhook and your Pipeline uses Continuous Delivery Rules, also select Pull request reviews and Check runs.

  11. Leave Active selected.

  12. Click Add webhook.

Paste the payload URL exactly as Gearset shows it. Gearset also uses application/json when it creates GitHub webhooks automatically, so choose the same content type here.
​

GitHub adds the webhook to the list on the Webhooks page. Repeat these steps for the second Gearset webhook, using its own payload URL and secret. When you’re done, the Webhooks page lists two Gearset webhooks: one with /pipeline/ in its payload URL and one with /continuous-integration-job/.
​

How do I check a GitHub webhook is working?

GitHub keeps a log of each webhook’s recent deliveries, so you can confirm Gearset is receiving events. Only repository Admins can see this log.

  1. In GitHub, go to Settings > Webhooks and click Edit next to the Gearset webhook.

  2. Click Recent deliveries.

  3. Click a delivery to see the request and Gearset’s response.

The response code on each GitHub delivery tells you what happened:

  • A 2xx response, such as 202, means Gearset received the delivery.

  • A 401 response from the Pipeline webhook means the secret in GitHub doesn’t match the secret in Gearset.

  • A 404 response from the CI job webhook can also mean the secret doesn’t match.

To fix a secret mismatch, copy the secret from the Gearset webhook modal again, edit the webhook in GitHub, and paste it into Secret. To resend an event after a fix, open the delivery and click Redeliver.
​

To check the CI job webhook from the Gearset side, open Webhook setup... on the CI job again. Gearset shows a confirmation when the CI job webhook is set up correctly.
​
​

Useful resources

If your Pipeline or CI jobs still don’t run after you set up both webhooks, please send a message to our support team, who will be happy to help.

Did this answer your question?