mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-12 08:34:43 +00:00
Merge dacc25f612
into a4eebd6005
This commit is contained in:
commit
c655cc2216
1 changed files with 10 additions and 18 deletions
|
@ -9,21 +9,20 @@ In additional to the [built-in Go template functions and features][tt], `webhook
|
||||||
In the example JSON template file below (YAML is also supported), the `payload-hmac-sha1` matching rule looks up the HMAC secret from the environment using the `getenv` template function.
|
In the example JSON template file below (YAML is also supported), the `payload-hmac-sha1` matching rule looks up the HMAC secret from the environment using the `getenv` template function.
|
||||||
Additionally, the result is piped through the built-in Go template function `js` to ensure that the result is a well-formed Javascript/JSON string.
|
Additionally, the result is piped through the built-in Go template function `js` to ensure that the result is a well-formed Javascript/JSON string.
|
||||||
|
|
||||||
```
|
```json
|
||||||
|
[
|
||||||
{
|
{
|
||||||
"id": "webhook",
|
"id": "webhook",
|
||||||
"execute-command": "/home/adnan/redeploy-go-webhook.sh",
|
"execute-command": "/home/adnan/redeploy-go-webhook.sh",
|
||||||
"command-working-directory": "/home/adnan/go",
|
"command-working-directory": "/home/adnan/go",
|
||||||
"response-message": "I got the payload!",
|
"response-message": "I got the payload!",
|
||||||
"response-headers":
|
"response-headers": [
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"name": "Access-Control-Allow-Origin",
|
"name": "Access-Control-Allow-Origin",
|
||||||
"value": "*"
|
"value": "*"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"pass-arguments-to-command":
|
"pass-arguments-to-command": [
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"source": "payload",
|
"source": "payload",
|
||||||
"name": "head_commit.id"
|
"name": "head_commit.id"
|
||||||
|
@ -37,29 +36,23 @@ Additionally, the result is piped through the built-in Go template function `js`
|
||||||
"name": "pusher.email"
|
"name": "pusher.email"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"trigger-rule":
|
"trigger-rule": {
|
||||||
{
|
"and": [
|
||||||
"and":
|
|
||||||
[
|
|
||||||
{
|
{
|
||||||
"match":
|
"match": {
|
||||||
{
|
|
||||||
"type": "payload-hmac-sha1",
|
"type": "payload-hmac-sha1",
|
||||||
"secret": "{{ getenv "XXXTEST_SECRET" | js }}",
|
"secret": "{{ getenv "XXXTEST_SECRET" | js }}",
|
||||||
"parameter":
|
"parameter": {
|
||||||
{
|
|
||||||
"source": "header",
|
"source": "header",
|
||||||
"name": "X-Hub-Signature"
|
"name": "X-Hub-Signature"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"match":
|
"match": {
|
||||||
{
|
|
||||||
"type": "value",
|
"type": "value",
|
||||||
"value": "refs/heads/master",
|
"value": "refs/heads/master",
|
||||||
"parameter":
|
"parameter": {
|
||||||
{
|
|
||||||
"source": "payload",
|
"source": "payload",
|
||||||
"name": "ref"
|
"name": "ref"
|
||||||
}
|
}
|
||||||
|
@ -69,7 +62,6 @@ Additionally, the result is piped through the built-in Go template function `js`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
[w]: https://github.com/adnanh/webhook
|
[w]: https://github.com/adnanh/webhook
|
||||||
|
|
Loading…
Add table
Reference in a new issue