https://github.com/tkuchiki/ghooks-cmd-runner
Receives Github webhooks and runs commands
https://github.com/tkuchiki/ghooks-cmd-runner
cli command github-webhooks golang receives-github-webhooks
Last synced: 2 months ago
JSON representation
Receives Github webhooks and runs commands
- Host: GitHub
- URL: https://github.com/tkuchiki/ghooks-cmd-runner
- Owner: tkuchiki
- Created: 2016-05-10T10:13:51.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-04-25T05:46:05.000Z (about 1 year ago)
- Last Synced: 2025-03-25T22:21:56.266Z (3 months ago)
- Topics: cli, command, github-webhooks, golang, receives-github-webhooks
- Language: Go
- Size: 50.8 KB
- Stars: 10
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ghooks-cmd-runner
Receives Github webhooks and runs commands## Installation
Download from https://github.com/tkuchiki/ghooks-cmd-runner/releases
## Usage
`-c, --config` is required.
```shell
$ ./ghooks-cmd-runner --help
usage: ghooks-cmd-runner --config=CONFIG []Receives Github webhooks and runs commands
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
-c, --config=CONFIG config file location
-p, --port=18889 listen port
--host="127.0.0.1" listen host
-l, --logfile=LOGFILE log file location
--pidfile=PIDFILE pid file location
--raw-payload raw payload
--version Show application version.
```### Config
```
# port = 18889 (default: 18889)
# host = "0.0.0.0 (default: 127.0.0.1)"
# secret = "your webhook secret"
# logfile = "path to logfile (default: stdout)"
# pidfile = "path to pidfile"[[hook]]
event = "push"
command = "/path/to/script"
branch = "feature/*"
# exclude_actions = ["deleted", "created"][[hook]]
event = "pull_request"
command = "/path/to/script"
# call Status API (See: https://developer.github.com/v3/repos/statuses/#create-a-status)
access_token = "your access token"
include_actions = [ "opened", "reopened" ]
# exclude_actions = [ "closed", "unlabeled" ]
```If you don't want to put secret in Config, alternatively you can store secret in .env file as follows:
```shell
SECRET_TOKEN=your webhook secret
```### Script
```shell
# read from stdin
cat - | base64 -d | jq .
``````shell
# change the target_url
echo http://example.com > ${SUCCESS_TARGET_FILE}
echo http://example.com > ${FAILURE_TARGET_FILE}
```## Example
```shell
$ ./ghooks-cmd-runner -c /path/to/config --pidfile /path/to/pid -l /path/to/logfile
ghooks server start 127.0.0.1:18889
```## TODO
- Unix Domain Socket
- Signal handling