# HG changeset patch # User Kim Alvefur # Date 1554047265 -7200 # Node ID 9556e92b2ec410049075437908a454d2c773b70d # Parent 5fb14ae57b4cacbe72c202f074d7d044bc8a8e5e mod_pubsub_github: Abort on unknown github events diff -r 5fb14ae57b4c -r 9556e92b2ec4 mod_pubsub_github/mod_pubsub_github.lua --- 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,