diff options
author | Robin Jarry <robin@jarry.cc> | 2024-04-03 01:06:48 +0200 |
---|---|---|
committer | Robin Jarry <robin@jarry.cc> | 2024-06-28 23:33:12 +0200 |
commit | df06d6558622a089b04a3ac6315c950967c1a49d (patch) | |
tree | 5ffd5fefc9a64bde6c146e0c7a4d6ab60f3774ee /contrib/ircbot/install-webhook.sh | |
parent | c15c265f7bcd6b0568b9d259673b7f302602f250 (diff) | |
download | aerc-df06d6558622a089b04a3ac6315c950967c1a49d.tar.gz |
ircbot: update webhook to handle applied patches
Register another webhook for all received emails and track the
X-Sourcehut-Patchset-Update header value. If it is APPLIED, then send
an IRC announce accordingly.
Use green for "applied" and light gr{e,a}y for "received".
Signed-off-by: Robin Jarry <robin@jarry.cc>
Tested-by: Bence Ferdinandy <bence@ferdinandy.com>
Diffstat (limited to 'contrib/ircbot/install-webhook.sh')
-rwxr-xr-x | contrib/ircbot/install-webhook.sh | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/contrib/ircbot/install-webhook.sh b/contrib/ircbot/install-webhook.sh index 1f8f12dd..d4db101c 100755 --- a/contrib/ircbot/install-webhook.sh +++ b/contrib/ircbot/install-webhook.sh @@ -2,9 +2,10 @@ set -xe -hut lists webhook create "https://lists.sr.ht/~rjarry/aerc-devel" \ - --stdin -e patchset_received \ - -u https://bot.diabeteman.com/sourcehut/ <<EOF +list="${1:-https://lists.sr.ht/~rjarry/aerc-devel}" +url="${2:-https://bot.diabeteman.com/sourcehut/}" + +hut lists webhook create "$list" --stdin -e patchset_received -u "$url" <<EOF query { webhook { uuid @@ -38,3 +39,29 @@ query { } } EOF + +hut lists webhook create "$list" --stdin -e email_received -u "$url" <<EOF +query { + webhook { + uuid + event + date + ... on EmailEvent { + email { + id + subject + patchset_update: header(want: "X-Sourcehut-Patchset-Update") + references: header(want: "References") + list { + name + owner { + ... on User { + canonicalName + } + } + } + } + } + } +} +EOF |