/technotes/ webhook
A simple HTTP server is written in Go to take incoming webhooks and execute actions. It supports methods of validating webhook secrets, and can pass values provided from the hook call into shell scripts.
Accepts a GitHub actions call, and validates a secret set on the call in Github.
[
{
"id": "hugo",
"execute-command": "/usr/local/src/hugo-sites/hugo-update.sh",
"command-working-directory": "/usr/local/src/hugo-sites",
"trigger-rule": {
"match": {
"type": "payload-hmac-sha1",
"secret": "xxxxxxxxxxxxx",
"parameter": {
"source": "header",
"name": "X-Hub-Signature"
}
}
}
},
]
Same as above, but passes in the repositories’ SSH URL to allow for the script to understand the source repository the webhook has come from. Uses the pass-arguments-to-command
setting.
The value repository.ssh_url
represents the path in the JSON submitted as part of the webhook.
[
{
"id": "hugo",
"execute-command": "/usr/local/src/hugo-sites/hugo-update.sh",
"command-working-directory": "/usr/local/src/hugo-sites",
"pass-arguments-to-command": [
{
"source": "payload",
"name": "repository.ssh_url"
}
],
"trigger-rule": {
"match": {
"type": "payload-hmac-sha1",
"secret": "xxxxxxxxxxxxx",
"parameter": {
"source": "header",
"name": "X-Hub-Signature"
}
}
}
},
]
Last updated: