https://github.com/jessety/github-webhook
A minimal GitHub webhook listener that executes a specified command when push occurs on the default branch, or when a release is published.
https://github.com/jessety/github-webhook
github-webhook github-webhook-handler github-webhook-listener
Last synced: 4 months ago
JSON representation
A minimal GitHub webhook listener that executes a specified command when push occurs on the default branch, or when a release is published.
- Host: GitHub
- URL: https://github.com/jessety/github-webhook
- Owner: jessety
- Created: 2020-08-01T14:03:41.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2020-08-21T19:38:32.000Z (almost 5 years ago)
- Last Synced: 2025-01-04T02:48:42.966Z (6 months ago)
- Topics: github-webhook, github-webhook-handler, github-webhook-listener
- Language: JavaScript
- Homepage:
- Size: 67.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# github-webhook
A minimal GitHub webhook listener that executes a script when a push event occurs on the default branch, or when a release is published.
[](https://github.com/jessety/github-webhook/actions)
## Installation
```bash
git clone ...
cd github-webhooknpm install --production
pm2 start ecosystem.config.json
```## Configuration
Populate an `.env` file in the project directory with the following options:
```ini
# GitHub Webhook Secret (required)
SECRET=ABC123# Script to execute when a release is published
SCRIPT_RELEASE=/usr/local/bin/release.sh# Script to execute when there is a push to the default branch
SCRIPT_PUSH=/usr/local/bin/push.sh# Name of the default branch, if it isn't "main" or "master"
DEFAULT_BRANCH=primary# Port to run the server on
PORT=32490
```## Scripts
Scripts are executed with the name of the repository as the first parameter, and the event type as the second.
Push events are only triggered when a push is made to the default branch. The script is executed with the name of that branch as its third parameter. Given the above configuration, the following will be executed a push is made to the `primary` branch:
```bash
/usr/local/bin/push.sh jessety/github-webhook push primary
```When a release is triggered, the release tag is sent as a third parameter:
```bash
/usr/local/bin/release.sh jessety/github-webhook release v1.1.4
```## License
MIT © Jesse Youngblood