Mercurial > prosody-modules
changeset 3513:9556e92b2ec4
mod_pubsub_github: Abort on unknown github events
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 31 Mar 2019 17:47:45 +0200 |
parents | 5fb14ae57b4c |
children | 8811b7dbe6e2 |
files | mod_pubsub_github/mod_pubsub_github.lua |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 16:59:08 2019 +0200 +++ b/mod_pubsub_github/mod_pubsub_github.lua Sun Mar 31 17:47:45 2019 +0200 @@ -26,7 +26,13 @@ return "Invalid JSON. From you of all people..."; end - module:log("debug", "Handling POST: \n%s\n", tostring(request.body)); + local github_event = request.headers.x_github_event + if github_event == "push" then + module:log("debug", "Handling 'push' event: \n%s\n", tostring(request.body)); + elseif github_event then + module:log("debug", "Unsupported Github event %q", github_event); + return 501; + end -- else .. is this even github? for _, commit in ipairs(data.commits) do local ok, err = pubsub_service:publish(node, true, data.repository.name,