🪝 call webhooks from github actions
Often I need to make things to happen in a GitHub Action by calling out to an external service. For example, I want to rebuild a website with a Netlify build hook or a Vercel deploy hook.
While you could write a bash script that executes a curl
command, I find it much easier to use the webhook-action by Joel Male. Include it in a workflow step with the uses
key, and add inputs under the with
key to specify details about the HTTP request.
I did run into one snag though. The body
and headers
fields have to be proper json
, which means the keys and values should be wrapped in double quotes. If you're trying to use a secret in your workflow, they cannot be inside of single quotes. That's because bash
preserves the literal values of characters within single quotes. In order to get this working, I had to disable prettier and escape the double quotes.