Reputation: 780
Details are given below.
apt-get install webhook
vim hooks.json
----------:
[
{
"id": "plan",
"execute-command": "/opt/hooks.com/hooks.sh",
"command-working-directory": "/opt/plan",
"response-message": "Webhook is rebuilding"
},
----------:
webhook -port 9500 -hooks hooks.json -verbose -hotreload -ip 10.128.22.125
Here hook URL is https://hooks.com/hooks/plan
This will trigger the hook and execute bash script on given directory. I am calling this webhook URL from GitHub to trigger on push events. I would like to add secrets to this webhook to ensure security when calling from hook URL. Please help me to setup secrets token with this webhook.
Thanks in advance.
Upvotes: 1
Views: 1865
Reputation: 780
Found a solution here https://github.com/adnanh/webhook/blob/master/docs/Hook-Rules.md
vim hooks.json
and put in the following content:
[
{
"id": "plan",
"execute-command": "/opt/hooks.com/hooks.sh",
"command-working-directory": "/opt/plan",
"response-message": "Webhook is rebuilding"
"trigger-rule":
{
"and":
[
{
"match":
{
"type": "payload-hash-sha1",
"secret": "yourSecretToken",
"parameter":
{
"source": "header",
"name": "X-Hub-Signature"
}
}
}
]
}
}
]
Upvotes: 1