~sircmpwn/sr.ht-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH hub.sr.ht] webhooks/git: use markdown for tracker comments

Details
Message ID
<20211129135554.286361-1-robin@jarry.cc>
DKIM signature
missing
Download raw message
Patch: +6 -4
The raw body of comments is included in email notifications. HTML makes
ugly plain text messages.

Use markdown for generated tracker comments which can be used in plain
text emails as-is.

Fixes: https://todo.sr.ht/~sircmpwn/hub.sr.ht/77
Fixes: be5d50d8d893 ("webhooks: update todo tickets with git commits")
Signed-off-by: Robin Jarry <robin@jarry.cc>
---
 hubsrht/blueprints/webhooks.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/hubsrht/blueprints/webhooks.py b/hubsrht/blueprints/webhooks.py
index 179c5309b92d..fe7b9f787ec3 100644
--- a/hubsrht/blueprints/webhooks.py
+++ b/hubsrht/blueprints/webhooks.py
@@ -143,16 +143,18 @@ def _handle_commit_trailer(trailer, value, pusher, repo, commit):
    commit_author = html.escape(commit["author"]["name"].strip())
    commit_sha = commit["id"][:7]
    commit_url = repo.url() + f"/commit/{commit_sha}"
    comment = (
        f"<i>{commit_author} referenced this ticket in commit " +
        f"<a href='{commit_url}' title='{commit_message}'>{commit_sha}</a>.</i>")
    comment = f"""\
*{commit_author} referenced this ticket in commit [{commit_sha}].*

[{commit_sha}]: {commit_url} "{commit_message}"\
"""
    try:
        todo.update_ticket(
            user=pusher,
            owner=match["owner"],
            tracker=match["tracker"],
            ticket=int(match["ticket"]),
            comment=" ".join(comment.split()).strip(),
            comment=comment,
            resolution=resolution,
        )
    except Exception:
-- 
2.30.2
Details
Message ID
<CG2BEICSSCV0.36L0WDOX48LJ@taiga>
In-Reply-To
<20211129135554.286361-1-robin@jarry.cc> (view parent)
DKIM signature
fail
Download raw message
DKIM signature: fail
Thanks!

To git@git.sr.ht:~sircmpwn/hub.sr.ht
   be5d50d..b5ebc44  master -> master

[hub.sr.ht/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CG2BF1EB8XCT.JDV4HMRZEUXL@cirno2>
In-Reply-To
<20211129135554.286361-1-robin@jarry.cc> (view parent)
DKIM signature
missing
Download raw message
hub.sr.ht/patches: SUCCESS in 2m28s

[webhooks/git: use markdown for tracker comments][0] from [Robin Jarry][1]

[0]: https://lists.sr.ht/~sircmpwn/sr.ht-dev/patches/26947
[1]: robin@jarry.cc

✓ #638441 SUCCESS hub.sr.ht/patches/archlinux.yml https://builds.sr.ht/~sircmpwn/job/638441
✓ #638440 SUCCESS hub.sr.ht/patches/alpine.yml    https://builds.sr.ht/~sircmpwn/job/638440
✓ #638442 SUCCESS hub.sr.ht/patches/debian.yml    https://builds.sr.ht/~sircmpwn/job/638442
Reply to thread Export thread (mbox)