Search code examples
gitgithubcontinuous-integrationgithub-apigithub-actions

How do I run a GitHub Webhook after my Github Action's Workflow has finished?


Currently my GitHub Webhook is set up to deploy my website every time a push on master branch occurs. Now, with GitHub Actions in place for CI, I want to run this Webhook only if my CI on GitHub succeeds.

Can I tell my GitHub Webhook to wait for GitHub's CI or shouldn't I use a Webhook anymore but manage this behavior in my GitHub workflow?


Solution

  • A webhook is a listener which is trigger by a specific JSON payload.

    You could:

    • modify your listener to detect a different payload
    • send that different payload from your GitHub Action

    That way, your local deployment process will be called by your GitHub Action.
    If that deployment was not a local one (meaning on your server instead of a server accessible from GitHub), there are quite a list of GitHub Actions dedicated to Deploy a site. In that case, no need for a webhook.