m 2 wiki-irc: use git.io shortener
This commit is contained in:
parent
ac3eec386c
commit
919b028fff
|
@ -16,9 +16,22 @@ in {
|
||||||
if ([pages]) {
|
if ([pages]) {
|
||||||
ruby {
|
ruby {
|
||||||
code => '
|
code => '
|
||||||
o = ""
|
require "net/http"
|
||||||
event["pages"].each { |p| o = o + "\"" + p["title"] + "\" " + p["action"] +" by "+ event["sender"]["login"]+" " +p["html_url"] + "/_compare/" + p["sha"] + "\n" }
|
require "net/https"
|
||||||
event["output"] = o
|
http = Net::HTTP.new("git.io", 443)
|
||||||
|
http.use_ssl = true
|
||||||
|
lines = []
|
||||||
|
event["pages"].each {|p|
|
||||||
|
url = "#{p["html_url"]}/_compare/#{p["sha"]}"
|
||||||
|
short_url = begin
|
||||||
|
request = Net::HTTP::Post.new "/"
|
||||||
|
request.set_form_data ({"url" => url })
|
||||||
|
response = http.request(request)
|
||||||
|
response["location"]
|
||||||
|
end
|
||||||
|
lines << "\"#{p["title"]}\" #{p["action"]} by #{event["sender"]["login"]} #{short_url}"
|
||||||
|
}
|
||||||
|
event["output"] = lines.join("\n")
|
||||||
'
|
'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue