Permalink
Browse files

HipChat: Only check branch restriction on pushes

Issue introduced by #481
  • Loading branch information...
1 parent 70690cb commit 3644bfdd35b9f6b82d91be07a721f214a22981e4 @powdahound powdahound committed Jan 2, 2013
Showing with 8 additions and 5 deletions.
  1. +8 −5 services/hipchat.rb
View
@@ -11,12 +11,15 @@ def receive_event
raise_config_error "Missing 'auth_token'" if data['auth_token'].to_s == ''
raise_config_error "Missing 'room'" if data['room'].to_s == ''
- branch = payload['ref'].split('/').last
- branch_restriction = data['restrict_to_branch'].to_s
+ # push events can be restricted to certain branches
+ if event.to_s == "push"
+ branch = payload['ref'].split('/').last
+ branch_restriction = data['restrict_to_branch'].to_s
- # check the branch restriction is poplulated and branch is not included
- if branch_restriction.length > 0 && branch_restriction.index(branch) == nil
- return
+ # check the branch restriction is poplulated and branch is not included
+ if branch_restriction.length > 0 && branch_restriction.index(branch) == nil
+ return
+ end
end
http.headers['X-GitHub-Event'] = event.to_s

0 comments on commit 3644bfd

Please sign in to comment.