Skip to content

Commit

Permalink
Log head commit and commit ids properly for push.
Browse files Browse the repository at this point in the history
  • Loading branch information
roidrage committed Oct 4, 2013
1 parent 668b0e5 commit 7d37950
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/travis/listener/app.rb
Expand Up @@ -79,9 +79,9 @@ def valid_ips

def handle_event
return unless handle_event?
debug "Request created: #{payload.inspect}"
info "uuid=#{uuid} delivery_guid=#{delivery_guid} type=#{event_type} repository=#{slug} #{event_details}"
Travis::Sidekiq::BuildRequest.perform_async(data)
debug "Request created: #{payload.inspect}"
end

def handle_event?
Expand Down Expand Up @@ -111,7 +111,9 @@ def event_details
if event_type == 'pull_request'
"number=#{decoded_payload['number']} action=#{decoded_payload['action']} source=#{decoded_payload['pull_request']['head']['repo']['full_name']} head=#{decoded_payload['pull_request']['head']['sha'][0..6]} ref=#{decoded_payload['pull_request']['head']['ref']} user=#{decoded_payload['pull_request']['user']['login']}"
else
"ref=#{decoded_payload['ref'][0..6]} head=#{decoded_payload['head']} commits=#{decoded_payload["commits"].map {|c| c['sha'][0..6]}.join(",")}"
"ref=#{decoded_payload['ref']} " +
"head=#{decoded_payload['head_commit']['id']} "
"commits=#{decoded_payload["commits"].map {|c| c['id'][0..6]}.join(",")}"
end
end

Expand Down
4 changes: 4 additions & 0 deletions spec/payloads.rb
Expand Up @@ -8,6 +8,10 @@
"name": "svenfuchs"
}
},
"head_commit": {
"id": "9854592",
"message": "Bump to 0.0.15"
},
"commits": [{
"id": "9854592",
"message": "Bump to 0.0.15",
Expand Down

0 comments on commit 7d37950

Please sign in to comment.