Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Commit

Permalink
Merge pull request #308 from JRusbatch/master
Browse files Browse the repository at this point in the history
Announce changes to Bitbucket repositories
  • Loading branch information
tombell committed Feb 22, 2012
2 parents 0975db9 + 2444e91 commit e7846af
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/scripts/bitbucket.coffee
@@ -0,0 +1,21 @@
# Announce changes to BitBucket repositories using BitBucket's POST service
# to a room sepecified by the URL.
#
# For instructions on how to set up BitBucket's POST service for your repositories,
# visit: http://confluence.atlassian.com/display/BITBUCKET/Setting+Up+the+bitbucket+POST+Service
#

module.exports = (robot) ->
robot.router.post '/hubot/bitbucket/:room', (req, res) ->
room = req.params.room

data = JSON.parse req.body.payload
commits = data.commits

msg = "#{data.user} pushed #{commits.length} commits to #{data.repository.name}:\n\n"
msg += "[#{commit.branch}] #{commit.message}\n" for commit in commits

robot.messageRoom room, msg

res.writeHead 204, { 'Content-Length': 0 }
res.end()

0 comments on commit e7846af

Please sign in to comment.