Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ See [`_team.json`](_team.json) for its example

#### Pull Request

You need to add `HUBOT_URL/hubot/github-pull-request?room=ROOM[&only-mentioned=1][&randm-mention=1]` to your repository's webhooks.
You need to add `HUBOT_URL/hubot/github-pull-request?room=ROOM[&only-mentioned=1][&randm-mention=1][&ignore-sender=1]` to your repository's webhooks.

| Parameter | Description |
| -------- | ----------- |
Expand All @@ -72,14 +72,16 @@ You need to add `HUBOT_URL/hubot/github-pull-request?room=ROOM[&only-mentioned=1
- When `&only-mentioned=1` is added, it sends notifications only when there are `@` mentions.
- When `&random-mention=1` is added, it picks-up a user from team.json and send notification.
- You can specify more than `2` in the value to pick-up more than two users.
- When `&ignore-sender=1` is added, it hide user name from notification sentence.

#### Issue

You need to add `HUBOT_URL/hubot/github-issue?room=ROOM[&only-mentioned=1]` to your repository's webhooks.
You need to add `HUBOT_URL/hubot/github-issue?room=ROOM[&only-mentioned=1][&ignore-sender=1]` to your repository's webhooks.

| Parameter | Description |
| -------- | ----------- |
| `HUBOT_URL` | Your Hubot server's url |
| `ROOM` | To which room you want to send notification |

- When `&only-mentioned=1` is added, it sends notifications only when there are `@` mentions.
- When `&ignore-sender=1` is added, it hide user name from notification sentence.
5 changes: 3 additions & 2 deletions lib/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ exports.buildMessage = (parts, opts) ->
random_mentions = if parts.random then random(mentions, opts.random_mention, opts.mention_team) else []
return null if opts.only_mentioned and mentions.length is 0 and random_mentions.length is 0
msg = ""
msg += "[#{parts.repository}] #{parts.action}: ##{parts.number} #{parts.title} by #{parts.user}\n"
msg += "#{parts.url}\n"
msg += "[#{parts.repository}] #{parts.action}: ##{parts.number} #{parts.title}"
msg += " by #{parts.user}" unless opts.ignore_sender
msg += "\n#{parts.url}\n"
msg += "#{parts.body}\n" if parts.body
msg += "Mentions: #{mentions.join(", ")}\n" if mentions.length
msg += "Congratulations! You are assigned: #{random_mentions.join(", ")}\n" if random_mentions.length
Expand Down
1 change: 1 addition & 0 deletions src/github-issue.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = (robot) ->
query = querystring.parse url.parse(req.url).query
opts =
only_mentioned: query["only-mentioned"]
ignore_sender: query["ignore-sender"]
parts = parseBody req.body
message = lib.buildMessage parts, opts
robot.send {room: query.room}, message if message
Expand Down
1 change: 1 addition & 0 deletions src/github-pull-request.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ module.exports = (robot) ->
only_mentioned: query["only-mentioned"]
random_mention: +query["random-mention"]
mention_team: query["mention-team"]
ignore_sender: query["ignore-sender"]
parts = parseBody req.body
message = lib.buildMessage parts, opts
robot.send {room: query.room}, message if message
Expand Down