A webhook handler for the headless CMS Sanity that triggers a GitHub Action on each content change.
410
A module that creates an authenticated Sanity webhook that triggers a GitHub action on each change to a Sanity dataset.
Create or extend an .env file in the root of your project and add the following keys:
Configure a GitHub Action in your GitHub Repository by adding a workflow file that will take certain steps once it is triggered. The following is an example of a workflow file that simply echoes once it is triggered:
name: repository_dispatch
on:
repository_dispatch:
types: production_build
jobs:
build:
name: Trigger workflow
runs-on: ubuntu-latest
steps:
- run: |
echo "Workflow triggered by Sanity webhook"
You can specify your GitHub action to run when a specific event_type value is sent in the repository_dispatch webhook payload. By default the event_type is 'production_build', which is triggered on changes made to the 'production' [Sanity dataset](https://www.sanity.io/docs/datasets.
In case you have defined multiple Sanity datasets, you can define specific GitHub actions for these datasets by using a specific event_type for this space.
Next, navigate to the API configuration panel in your Sanity Studio dashboard and add a new webhook by supplying a URL endpoint at which the current project can receive POST requests. Append this endpoint with:
?hum_shared_secret=*insert a shared secret here*
Finally run the following command to activate the Sanity webhook:
$ npm start
Contributions, issues and feature requests are welcome.
Feel free to check issues page if you want to contribute.
👤 Humanoids
👤 Robbin Habermehl
👤 Ruben Werdmüller
👤 Dylan Jongbloed
Copyright © 2020 Humanoids BV.
Content type
Image
Digest
Size
59.9 MB
Last updated
about 6 years ago
docker pull humanoids/sanity-webhook-github