From e6542f3fb2dd57ea8ca7ab710cb7b70abba16590 Mon Sep 17 00:00:00 2001 From: jesopo Date: Sat, 17 Nov 2018 20:48:19 +0000 Subject: [PATCH] Correctly show new tags being created in modules/github.py --- modules/github.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/github.py b/modules/github.py index 1de730fa..cdd51b2c 100644 --- a/modules/github.py +++ b/modules/github.py @@ -3,6 +3,7 @@ from src import ModuleManager, utils COMMIT_URL = "https://github.com/%s/commit/%s" COMMIT_RANGE_URL = "https://github.com/%s/compare/%s…%s" +TAG_URL = "https://github.com/%s/releases/tag/%s" COMMENT_ACTIONS = { "created": "commented", @@ -83,7 +84,13 @@ class Module(ModuleManager.BaseModule): def push(self, event, full_name, data): outputs = [] - if len(data["commits"]) <= 3: + ref = data["ref"] + if ref.startswith("refs/tags/"): + tag = ref.split("refs/tags/", 1)[1] + pusher = utils.irc.bold(data["pusher"]["name"]) + outputs.append("(%s) %s pushed new tag: %s - %s" + % (full_name, pusher, tag, TAG_URL % tag)) + elif len(data["commits"]) <= 3: for commit in data["commits"]: id = self._short_hash(commit["id"]) message = commit["message"].split("\n")[0].strip()