Skip to content
Discussion options

You must be logged in to vote

You can configure a GitHub webhook to notify your CI/CD service whenever a push event occurs on the main branch.
Go to your repository. settings ,Webhooks, Add webhook.
In the Payload URL, enter the endpoint of your CI/CD server and Set Content type to application/json.
Under Which events would you like to trigger this webhook?, choose "Just the push event". Save the webhook.
Your CI/CD server should now handle the push event payload. The payload includes information like the branch, commit ID, and author your service can parse this JSON and start the build process only if ref equals "refs/heads/main".

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@doguexp
Comment options

Answer selected by doguexp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API and Webhooks Discussions related to GitHub's APIs or Webhooks Question Ask and answer questions about GitHub features and usage
2 participants