Skip to content

Instantly share code, notes, and snippets.

@steffentchr
Last active December 19, 2015 14:09
Show Gist options
  • Select an option

  • Save steffentchr/5966844 to your computer and use it in GitHub Desktop.

Select an option

Save steffentchr/5966844 to your computer and use it in GitHub Desktop.
Podio "integration" for Github, works through a simple web POST hook. (And yes, this is annoyingly ugly in how the payload is written to vars and then a `$message`. If you ever use this, at least generalize a bit -- and cut the lines by half. Should make it more readable.)
ad_page_contract {} {
payload:notnull
}
package require json
set payload [json::json2dict $payload]
set repository [dict get $payload repository]
set repository_name [dict get $repository name]
set repository_url [dict get $repository url]
foreach commit [dict get $payload commits] {
set commit_id [dict get $commit id]
set commit_message [dict get $commit message]
set commit_url [dict get $commit url]
set commit_added [dict get $commit added]
set commit_removed [dict get $commit removed]
set commit_modified [dict get $commit modified]
set author [dict get $commit author]
set author_name [dict get $author name]
set author_email [dict get $author email]
set author_name [lindex [split $author_name { }] 0]
set commit_id [string range $commit_id 0 7]
set message "\[@${author_name}\](mailto:${author_email}) did something cool: *${commit_message}* \n"
if { $commit_added ne "" } {
append message "\n\n*Added*: ${commit_added}"
}
if { $commit_removed ne "" } {
append message "\n\n*Removed*: ${commit_removed}"
}
if { $commit_modified ne "" } {
append message "\n\n*Modified*: ${commit_modified}"
}
append message "\n\n(\[${commit_id}\](${commit_url}) on \[${repository_name}\](${repository_url}))"
um::util::podio -force $message
}
doc_return 200 text/plain OK
ad_script_abort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment