https://github.com/badsyntax/strapi-webhook-actions-proxy
Strapi webhook proxy to trigger a GitHub repository_dispatch event
https://github.com/badsyntax/strapi-webhook-actions-proxy
docker github-actions strapi strapijs
Last synced: 3 months ago
JSON representation
Strapi webhook proxy to trigger a GitHub repository_dispatch event
- Host: GitHub
- URL: https://github.com/badsyntax/strapi-webhook-actions-proxy
- Owner: badsyntax
- License: mit
- Created: 2021-06-19T06:39:49.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-26T00:13:19.000Z (over 2 years ago)
- Last Synced: 2025-02-28T22:55:07.842Z (3 months ago)
- Topics: docker, github-actions, strapi, strapijs
- Language: TypeScript
- Homepage: https://github.com/badsyntax/strapi-webhook-actions-proxy/pkgs/container/strapi-webhook-actions-proxy
- Size: 393 KB
- Stars: 9
- Watchers: 3
- Forks: 4
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Strapi Webhook GitHub Actions Proxy
[](https://github.com/badsyntax/strapi-webhook-actions-proxy/actions/workflows/prod-deploy.yml)
[](https://github.com/badsyntax/strapi-webhook-actions-proxy/actions/workflows/analyze.yml)
[](https://github.com/badsyntax/strapi-webhook-actions-proxy/actions/workflows/codeql-analysis.yml)A super simple & lightweight Node.js proxy to send `repository_dispatch` events to GitHub from a Strapi Webhook.
Useful when you want to run a GitHub Actions workflow when changes are made in Strapi.
## Usage
1 - Ensure your GitHub Actions workflow file handles the "repository_dispatch" event with your custom type:
```yml
name: Deploy
on:
repository_dispatch:
types: [strapi_updated]
```2 - Create a GitHub Personal access token with `repo` scope
3 - Deploy the service to your server, for example:
```bash
docker run \
--publish 5000:5000 \
--env GITHUB_TOKEN=YOURTOKEN \
ghcr.io/badsyntax/strapi-webhook-actions-proxy:latest
```(View [available docker tags](https://github.com/users/badsyntax/packages/container/package/strapi-webhook-actions-proxy), or just use `latest`.)
4 - Create a new Webhook in Strapi that points to the service with the following query params:
- `event_type`: Any string. This value must match the `repository_dispatch` type specified in your GitHub Actions workflow file.
- `repo`: GitHub `username/repo`For example:
```
http://actions-proxy:5000/api?event_type=strapi_updated&repo=username/awesome-website
```## Background
You can't point Strapi webhooks to the [repository dispatch event endpoint](https://docs.github.com/en/rest/reference/repos#create-a-repository-dispatch-event) as the webook request body is not compatible with the dispatches endpoint, thus a proxy is required.
## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md)
## License
See [LICENSE.md](./LICENSE.md)