mirror of
https://git.sr.ht/~rjarry/aerc
synced 2025-07-15 15:43:50 +02:00

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>
67 lines
950 B
Bash
Executable file
67 lines
950 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -xe
|
|
|
|
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
|
|
event
|
|
date
|
|
... on PatchsetEvent {
|
|
patchset {
|
|
id
|
|
subject
|
|
version
|
|
prefix
|
|
list {
|
|
name
|
|
owner {
|
|
... on User {
|
|
canonicalName
|
|
}
|
|
}
|
|
}
|
|
submitter {
|
|
... on User {
|
|
canonicalName
|
|
}
|
|
... on Mailbox {
|
|
name
|
|
address
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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
|