From 98fd34bfe340fae6d0fd3b7333b6f9a6647cbae2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 20 Jun 2015 20:55:50 -0400 Subject: Improve automatic action to create comments based on commit messages --- app/Integration/GithubWebhook.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'app/Integration/GithubWebhook.php') diff --git a/app/Integration/GithubWebhook.php b/app/Integration/GithubWebhook.php index 607bbc1e..a725f5b9 100644 --- a/app/Integration/GithubWebhook.php +++ b/app/Integration/GithubWebhook.php @@ -90,12 +90,19 @@ class GithubWebhook extends \Core\Base continue; } - if ($task['project_id'] == $this->project_id) { - $this->container['dispatcher']->dispatch( - self::EVENT_COMMIT, - new GenericEvent(array('task_id' => $task_id) + $task) - ); + if ($task['project_id'] != $this->project_id) { + continue; } + + $this->container['dispatcher']->dispatch( + self::EVENT_COMMIT, + new GenericEvent(array( + 'task_id' => $task_id, + 'commit_message' => $commit['message'], + 'commit_url' => $commit['url'], + 'commit_comment' => $commit['message']."\n\n[".t('Commit made by @%s on Github', $commit['author']['username']).']('.$commit['url'].')' + ) + $task) + ); } return true; -- cgit v1.2.3