comparison mod_pubsub_github/mod_pubsub_github.lua @ 3516:d94875c3ddda

mod_pubsub_github: Publish with item id set to commit hash (BC)
author Kim Alvefur <zash@zash.se>
date Sun, 31 Mar 2019 18:08:50 +0200
parents f756e051fa02
children ea1edd7cfb01
comparison
equal deleted inserted replaced
3515:f756e051fa02 3516:d94875c3ddda
36 module:log("debug", "Unsupported Github event %q", github_event); 36 module:log("debug", "Unsupported Github event %q", github_event);
37 return 501; 37 return 501;
38 end -- else .. is this even github? 38 end -- else .. is this even github?
39 39
40 for _, commit in ipairs(data.commits) do 40 for _, commit in ipairs(data.commits) do
41 local ok, err = pubsub_service:publish(node, github_actor, data.repository.name, 41 local ok, err = pubsub_service:publish(node, github_actor, commit.id,
42 st.stanza("item", { id = data.repository.name, xmlns = "http://jabber.org/protocol/pubsub" }) 42 st.stanza("item", { id = commit.id, xmlns = "http://jabber.org/protocol/pubsub" })
43 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" }) 43 :tag("entry", { xmlns = "http://www.w3.org/2005/Atom" })
44 :tag("id"):text(commit.id):up() 44 :tag("id"):text(commit.id):up()
45 :tag("title"):text(commit.message):up() 45 :tag("title"):text(commit.message):up()
46 :tag("link", { rel = "alternate", href = commit.url }):up() 46 :tag("link", { rel = "alternate", href = commit.url }):up()
47 :tag("published"):text(commit.timestamp):up() 47 :tag("published"):text(commit.timestamp):up()