Search code examples
githubwebhooks

Setup GitHub Webhook for AWS EC2 server


I have a web application deployed in an AWS EC2 instance. I recently learnt about GitHub Webhooks and I am now trying to setup a webhook service for my EC2 server.

I have two questions:

  1. How can I receive the webhook payload to a specific endpoint on my server?
  2. What will be the payload URL that I have to provide when setting up the GitHub webhook?

Solution

  • First you need to go to your repo, and click through this sequence:

    Settings -> Webhooks & Services -> Add webhook

    Then paste the url where github will submit data for each new commit. You can find examples of payload in example.

    Then implement the logic needed in the backend to work with info about new commits.