Skip to content

Commit

Permalink
Merge pull request #67 from tomaslin/git-events
Browse files Browse the repository at this point in the history
Add github events
  • Loading branch information
tomaslin committed Feb 5, 2016
2 parents 8bb344c + 17906de commit 866b9a7
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
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 866b9a7

Please sign in to comment.