aboutsummaryrefslogtreecommitdiffstats
path: root/local
diff options
context:
space:
mode:
authorkongr45gpen <electrovesta@gmail.com>2016-07-17 22:19:27 +0300
committerkongr45gpen <electrovesta@gmail.com>2016-07-17 22:20:19 +0300
commit8dd785e693406693ca2a1b92efecd1d9e53e17d9 (patch)
tree8ab21b180f487ffbcbcb9b85db8119f47f432237 /local
parentdd39db4330b1dc762c3e0f68f43cfb7b65651aef (diff)
downloadsupybot_github-8dd785e693406693ca2a1b92efecd1d9e53e17d9.tar.gz
supybot_github-8dd785e693406693ca2a1b92efecd1d9e53e17d9.tar.bz2
supybot_github-8dd785e693406693ca2a1b92efecd1d9e53e17d9.zip
Add support for Github releases
Diffstat (limited to 'local')
-rw-r--r--local/handler/GithubHandler.py3
-rw-r--r--local/handler/ReleaseHandler.py13
-rw-r--r--local/theme/DefaultTheme.py12
-rw-r--r--local/utility.py3
4 files changed, 30 insertions, 1 deletions
diff --git a/local/handler/GithubHandler.py b/local/handler/GithubHandler.py
index 8788ea3..ffb5010 100644
--- a/local/handler/GithubHandler.py
+++ b/local/handler/GithubHandler.py
@@ -33,6 +33,7 @@ import IssueHandler
import StatusHandler
import TravisHandler
import MessageHandler
+import ReleaseHandler
import CreateDeleteHandler
import IssueCommentHandler
@@ -166,6 +167,8 @@ class GithubHandler(BaseHTTPServer.BaseHTTPRequestHandler):
IssueHandler.handle(data, theme)
elif 'ref_type' in data:
CreateDeleteHandler.handle(data, theme)
+ elif 'release' in data:
+ ReleaseHandler.handle(data, theme)
elif 'zen' in data:
PingHandler.handle(data, theme)
elif 'message' in data:
diff --git a/local/handler/ReleaseHandler.py b/local/handler/ReleaseHandler.py
new file mode 100644
index 0000000..4c13a69
--- /dev/null
+++ b/local/handler/ReleaseHandler.py
@@ -0,0 +1,13 @@
+from ..utility import *
+
+def handle(data, theme):
+ theme.release(
+ action = data['action'],
+ author = data['release']['author']['login'],
+ commit = data['release']['target_commitish'],
+ description = data['release']['body'],
+ name = data['release']['name'],
+ prerelease = data['release']['prerelease'],
+ tag = data['release']['tag_name'],
+ url = getShortURL(data['release']['html_url'])
+ )
diff --git a/local/theme/DefaultTheme.py b/local/theme/DefaultTheme.py
index 55d0863..3f29022 100644
--- a/local/theme/DefaultTheme.py
+++ b/local/theme/DefaultTheme.py
@@ -103,6 +103,18 @@ class DefaultTheme(Theme):
": %s" % maxLen(comment, 70) if comment else ''
))
+ def release(self, author, action, name, tag, description, commit, prerelease, url):
+ self.msgs.append( "%s: %s %s%s %s (%s): %s %s" % (
+ self.repo(),
+ ircutils.mircColor(author, "green"),
+ colorAction(action),
+ " %s" % (ircutils.mircColor('prerelease', "orange")) if prerelease else '',
+ ircutils.bold(name),
+ ircutils.mircColor(tag, "dark gray"),
+ maxLen(description, 100),
+ self.enclose(url)
+ ))
+
def wikiPush(self, actor, count, url):
self.msgs.append( "%s: %s modified %s wiki %s %s:" % (
self.repo(),
diff --git a/local/utility.py b/local/utility.py
index ef37c28..a1d41bd 100644
--- a/local/utility.py
+++ b/local/utility.py
@@ -80,7 +80,8 @@ def maxLen(msg, maxn=400, splitLines=True):
def colorAction(action):
"""Give an action string (e.g. created, edited) and get a nice IRC colouring"""
- if action in [ "created", "opened", "tagged", "success", "passed", "fixed" ]:
+ if action in [ "created", "opened", "tagged", "success", "passed", "fixed",
+ "published" ]:
return ircutils.bold(ircutils.mircColor(action, "green"))
if action in [ "deleted" ,"closed", "re-tagged", "deleted tag",
"failed", "errored", "failure", "still failing",

© 2014-2024 Faster IT GmbH | imprint | privacy policy