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

Commit e7846af

Browse files
committed
Merge pull request #308 from JRusbatch/master
Announce changes to Bitbucket repositories
2 parents 0975db9 + 2444e91 commit e7846af

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/scripts/bitbucket.coffee

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Announce changes to BitBucket repositories using BitBucket's POST service
2+
# to a room sepecified by the URL.
3+
#
4+
# For instructions on how to set up BitBucket's POST service for your repositories,
5+
# visit: http://confluence.atlassian.com/display/BITBUCKET/Setting+Up+the+bitbucket+POST+Service
6+
#
7+
8+
module.exports = (robot) ->
9+
robot.router.post '/hubot/bitbucket/:room', (req, res) ->
10+
room = req.params.room
11+
12+
data = JSON.parse req.body.payload
13+
commits = data.commits
14+
15+
msg = "#{data.user} pushed #{commits.length} commits to #{data.repository.name}:\n\n"
16+
msg += "[#{commit.branch}] #{commit.message}\n" for commit in commits
17+
18+
robot.messageRoom room, msg
19+
20+
res.writeHead 204, { 'Content-Length': 0 }
21+
res.end()

0 commit comments

Comments
 (0)