aboutsummaryrefslogtreecommitdiff
path: root/modules/github.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-01-10 22:14:40 +0000
committerGravatar jesopo2019-01-10 22:14:40 +0000
commitcbc0e81fb3cf0afd7796f2e268efbae63654748b (patch)
tree0042287bcb9ea39faa6b1c537c13824e41773d37 /modules/github.py
parentPass username, repository, number to _gh_issue and _gh_pull (github.py) (diff)
signature
Send a notice to a channel when a new webhook registration is received
(github.py)
Diffstat (limited to 'modules/github.py')
-rw-r--r--modules/github.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/github.py b/modules/github.py
index 1ed558a4..ce7896bd 100644
--- a/modules/github.py
+++ b/modules/github.py
@@ -11,6 +11,7 @@ API_ISSUE_URL = "https://api.github.com/repos/%s/%s/issues/%s"
API_PULL_URL = "https://api.github.com/repos/%s/%s/pulls/%s"
DEFAULT_EVENTS = [
+ "ping",
"push",
"commit_comment",
"pull_request",
@@ -124,8 +125,6 @@ class Module(ModuleManager.BaseModule):
data = json.loads(payload)
github_event = event["headers"]["X-GitHub-Event"]
- if github_event == "ping":
- return ""
full_name = data["repository"]["full_name"]
repo_username, repo_name = full_name.split("/", 1)
@@ -174,6 +173,8 @@ class Module(ModuleManager.BaseModule):
outputs = self.status(event, full_name, data)
elif github_event == "fork":
outputs = self.fork(event, full_name, data)
+ elif github_event == "ping":
+ outputs = self.ping(event, full_name, data)
if outputs:
for server, channel in targets:
@@ -194,6 +195,9 @@ class Module(ModuleManager.BaseModule):
except utils.http.HTTPTimeoutException:
return url
+ def ping(self, event, full_name, data):
+ return ["Received new webhook for %s" % full_name]
+
def _change_count(self, n, symbol, color):
return utils.irc.color("%s%d" % (symbol, n), color)+utils.irc.bold("")
def _added(self, n):