Skip to content

Commit

Permalink
convert github event type
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaslin committed Feb 5, 2016
1 parent c7ca197 commit 17906de
Showing 1 changed file with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,19 @@ class WebhooksController {
event.details.type = type
event.content = postedEvent

if (type == 'git' && source == 'stash') {
event.content.hash = postedEvent.refChanges?.first().toHash
event.content.branch = postedEvent.refChanges?.first().refId.replace('refs/heads/', '')
event.content.repoProject = postedEvent.repository.project.key
event.content.slug = postedEvent.repository.slug
if (type == 'git') {
if (source == 'stash') {
event.content.hash = postedEvent.refChanges?.first().toHash
event.content.branch = postedEvent.refChanges?.first().refId.replace('refs/heads/', '')
event.content.repoProject = postedEvent.repository.project.key
event.content.slug = postedEvent.repository.slug
}
if (source == 'github') {
event.content.hash = postedEvent.after
event.content.branch = postedEvent.ref.replace('refs/heads/', '')
event.content.repoProject = postedEvent.repository.owner.name
event.content.slug = postedEvent.repository.name
}
}

log.info("Webhook ${source}:${type}:${event.content}")
Expand Down

0 comments on commit 17906de

Please sign in to comment.