Skip to content

Commit ef253ea

Browse files
committed
1 parent 41d9e4a commit ef253ea

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

README.md

+7-11
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ You can listen for the event and use as much of the data as you want.
5858

5959
If you want hubot to write to your chat room a message like this:
6060

61-
> hubot: [repo_owner/repo] <#sha|link> commit message
61+
> hubot: [repo_owner/repo] <link|#sha> commit message
6262
> commit description
6363
> - commit author
6464
@@ -79,7 +79,6 @@ Add `["hubot-bitbucket-commit"]` to `hubot-scripts.json` (or whatever you want)
7979
# GabLeRoux
8080
#
8181

82-
# https://github.com/slackhq/hubot-slack/issues/114 wtf slack...
8382
module.exports = (robot) ->
8483
bitbucketPushEvent = process.env.HUBOT_BITBUCKET_PUSH_EVENT or 'bitbucketPushReceived'
8584
room = process.env.HUBOT_BITBUCKET_PUSH_ROOM or 'general'
@@ -90,8 +89,6 @@ module.exports = (robot) ->
9089
repo_url = res.repository.links.html.href
9190
commits_url = res.push.changes[0].links.html.href
9291

93-
response = "[#{repo_name}] #{repo_url}\n"
94-
9592
commit = res.push.changes[0].new
9693
new_commit_author_username = commit.target.author.user.username
9794
new_commit_author_display_name = commit.target.author.user.display_name
@@ -104,11 +101,11 @@ module.exports = (robot) ->
104101
new_commit_name = commit.name
105102
new_commit_on = new_commit_type + " " + new_commit_name
106103

104+
response = "<#{repo_url}|[#{repo_name}]>\n"
107105
response += "New commit(s) on #{new_commit_on}\n"
108-
response += "#{commits_url}\n"
109-
response += "#{new_commit_hash_short} #{new_commit_message}\n"
110-
response += " - #{new_commit_author_display_name} (#{new_commit_author_username})\n"
111-
106+
response += "<#{commits_url}|#{new_commit_hash_short}> #{new_commit_message}\n"
107+
response += " - <#{new_commit_author_url}|#{new_commit_author_display_name} (#{new_commit_author_username})>\n"
108+
112109
robot.messageRoom room, response
113110

114111
return
@@ -117,10 +114,9 @@ module.exports = (robot) ->
117114

118115
It should display something like this:
119116
```
120-
[gableroux/some-repository] https://bitbucket.org/gableroux/some-repository
117+
<https://bitbucket.org/gableroux/some-repository|[gableroux/some-repository]>
121118
New commit(s) on branch master
122-
https://bitbucket.org/gableroux/some-repository/branches/compare/2ad9d60ef4f9369c5668c9dd9e3798c91e4f30cd..14c2888e3c6678d26c1b65c9f45cd5bad79b8370
123-
2ad9d60 Some commit message
119+
<https://bitbucket.org/gableroux/some-repository/branches/compare/2ad9d60ef4f9369c5668c9dd9e3798c91e4f30cd..14c2888e3c6678d26c1b65c9f45cd5bad79b8370|2ad9d60> Some commit message
124120
125121
* Support for multiline commit message
126122
* Some other content in commit message, etc.

0 commit comments

Comments
 (0)