зеркало из
1
0
Форкнуть 0

Add transitions to handle (un)suppression of tickets

This commit is contained in:
Nick Fyson 2019-02-11 15:39:24 +00:00
Родитель 2093814ea5
Коммит 02a3abad5f
1 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -80,6 +80,23 @@ def lgtm_webhook():
data=json.dumps({"state": transition}),
)
elif transition == "suppress":
r = session.post(
"/".join([URL, str(issue_id), "labels"]),
data=json.dumps([SUPPRESSION_LABEL]),
)
elif transition == "unsuppress":
r = session.delete(
"/".join([URL, str(issue_id), "labels", SUPPRESSION_LABEL])
)
# if the label was not present on the issue, we don't let this worry us
if not r.ok and r.json().get("message") == "Label does not exist":
r.status_code = 200
else: # no matching transitions found
return (
jsonify({"message": "unknown transition type - %s" % transition}),