From 80c0f04ffb5a7ebff405abdd81060f8a1a0fefe3 Mon Sep 17 00:00:00 2001 From: Jonathan Leroy Date: Fri, 22 Aug 2025 05:12:24 +0200 Subject: [PATCH 1/2] Fix Gitea incoming webhook example and add a YAML version --- docs/Hook-Examples.md | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index 08de456..e7e3f7d 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -214,7 +214,11 @@ Values in the request body can be accessed in the command or to the match rule b } ] ``` + ## Incoming Gitea webhook + +JSON version: + ```json [ { @@ -229,7 +233,7 @@ Values in the request body can be accessed in the command or to the match rule b }, { "source": "payload", - "name": "pusher.name" + "name": "pusher.full_name" }, { "source": "payload", @@ -243,12 +247,12 @@ Values in the request body can be accessed in the command or to the match rule b { "match": { - "type": "value", + "type": "payload-hmac-sha256", "value": "mysecret", "parameter": { - "source": "payload", - "name": "secret" + "source": "header", + "name": "X-Gitea-Signature" } } }, @@ -256,7 +260,7 @@ Values in the request body can be accessed in the command or to the match rule b "match": { "type": "value", - "value": "refs/heads/master", + "value": "refs/heads/main", "parameter": { "source": "payload", @@ -270,6 +274,35 @@ Values in the request body can be accessed in the command or to the match rule b ] ``` +YAML version: + +```yaml +- id: webhook + execute-command: /home/adnan/redeploy-go-webhook.sh + command-working-directory: /home/adnan/go + pass-arguments-to-command: + - source: payload + name: head_commit.id + - source: payload + name: pusher.full_name + - source: payload + name: pusher.email + trigger-rule: + and: + - match: + type: payload-hmac-sha256 + secret: mysecret + parameter: + source: header + name: X-Gitea-Signature + - match: + type: value + value: refs/heads/main + parameter: + source: payload + name: ref +``` + ## Slack slash command ```json [ From 3d00687c18d763b1fedec40309aa77e5dc20d901 Mon Sep 17 00:00:00 2001 From: Jonathan Leroy Date: Fri, 22 Aug 2025 05:16:10 +0200 Subject: [PATCH 2/2] Fix payload-hmac-sha256 secret attribute name --- docs/Hook-Examples.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Hook-Examples.md b/docs/Hook-Examples.md index e7e3f7d..854d010 100644 --- a/docs/Hook-Examples.md +++ b/docs/Hook-Examples.md @@ -248,7 +248,7 @@ JSON version: "match": { "type": "payload-hmac-sha256", - "value": "mysecret", + "secret": "mysecret", "parameter": { "source": "header",