Don't forget to set POST webhook payload format to "application/json" (not form)
$ go get github.com/adnanh/webhook
$ sudo systemctl daemon-reload
$ sudo systemctl enable webhook
$ sudo service webhook start
$ journalctl -u webhook
[ | |
{ | |
"id": "webhook", | |
"execute-command": "/home/karl/go/src/github.com/kleicht/REPO_NAME/redeploy.sh", | |
"command-working-directory": "/home/karl/go/src/github.com/kleicht/REPO_NAME", | |
"response-message": "I got the payload!", | |
"response-headers": | |
[ | |
{ | |
"name": "Access-Control-Allow-Origin", | |
"value": "*" | |
} | |
], | |
"pass-arguments-to-command": | |
[ | |
{ | |
"source": "payload", | |
"name": "head_commit.id" | |
}, | |
{ | |
"source": "payload", | |
"name": "pusher.name" | |
}, | |
{ | |
"source": "payload", | |
"name": "pusher.email" | |
} | |
], | |
"trigger-rule": | |
{ | |
"and": | |
[ | |
{ | |
"match": | |
{ | |
"type": "payload-hash-sha1", | |
"secret": "SECRET", | |
"parameter": | |
{ | |
"source": "header", | |
"name": "X-Hub-Signature" | |
} | |
} | |
}, | |
{ | |
"match": | |
{ | |
"type": "value", | |
"value": "refs/heads/master", | |
"parameter": | |
{ | |
"source": "payload", | |
"name": "ref" | |
} | |
} | |
} | |
] | |
} | |
} | |
] |
Don't forget to set POST webhook payload format to "application/json" (not form)
$ go get github.com/adnanh/webhook
$ sudo systemctl daemon-reload
$ sudo systemctl enable webhook
$ sudo service webhook start
$ journalctl -u webhook
[Unit] | |
Description=Go webhooks | |
[Service] | |
Restart=always | |
RestartSec=3 | |
WorkingDirectory=/home/karl/ | |
ExecStart=/home/karl/go/bin/webhook -hotreload -verbose | |
User=karl | |
[Install] | |
WantedBy=multi-user.target |