Handle github_event 'ping'

This commit is contained in:
jesopo 2018-11-06 16:08:02 +00:00
parent 7c49152ef6
commit 0e2d2b268a

View file

@ -11,6 +11,10 @@ class Module(ModuleManager.BaseModule):
def github(self, event): def github(self, event):
data = json.loads(event["data"]) data = json.loads(event["data"])
github_event = event["headers"]["X-GitHub-Event"]
if github_event == "ping":
return True
full_name = data["repository"]["full_name"] full_name = data["repository"]["full_name"]
hooks = self.bot.database.channel_settings.find_by_setting( hooks = self.bot.database.channel_settings.find_by_setting(
"github-hook") "github-hook")
@ -21,8 +25,6 @@ class Module(ModuleManager.BaseModule):
if not hooks: if not hooks:
return None return None
github_event = event["headers"]["X-GitHub-Event"]
outputs = None outputs = None
if github_event == "push": if github_event == "push":
outputs = self.push(event, full_name, data) outputs = self.push(event, full_name, data)