This repository has been archived by the owner on Apr 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
/
Plugin.php
65 lines (53 loc) · 2.42 KB
/
Plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Kanboard\Plugin\GitlabWebhook;
use Kanboard\Core\Plugin\Base;
use Kanboard\Core\Security\Role;
use Kanboard\Core\Translator;
class Plugin extends Base
{
public function initialize()
{
$this->actionManager->getAction('\Kanboard\Action\CommentCreation')->addEvent(WebhookHandler::EVENT_ISSUE_COMMENT);
$this->actionManager->getAction('\Kanboard\Action\CommentCreation')->addEvent(WebhookHandler::EVENT_COMMIT);
$this->actionManager->getAction('\Kanboard\Action\TaskClose')->addEvent(WebhookHandler::EVENT_COMMIT);
$this->actionManager->getAction('\Kanboard\Action\TaskClose')->addEvent(WebhookHandler::EVENT_ISSUE_CLOSED);
$this->actionManager->getAction('\Kanboard\Action\TaskCreation')->addEvent(WebhookHandler::EVENT_ISSUE_OPENED);
$this->actionManager->getAction('\Kanboard\Action\TaskOpen')->addEvent(WebhookHandler::EVENT_ISSUE_REOPENED);
$this->template->hook->attach('template:project:integrations', 'GitlabWebhook:project/integrations');
$this->route->addRoute('/webhook/gitlab/:project_id/:token', 'WebhookController', 'handler', 'GitlabWebhook');
$this->applicationAccessMap->add('WebhookController', 'handler', Role::APP_PUBLIC);
}
public function onStartup()
{
Translator::load($this->languageModel->getCurrentLanguage(), __DIR__.'/Locale');
$this->eventManager->register(WebhookHandler::EVENT_COMMIT, t('GitLab commit received'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_OPENED, t('GitLab issue opened'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_CLOSED, t('GitLab issue closed'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_REOPENED, t('GitLab issue reopened'));
$this->eventManager->register(WebhookHandler::EVENT_ISSUE_COMMENT, t('GitLab issue comment created'));
}
public function getPluginName()
{
return 'GitLab Webhook';
}
public function getPluginDescription()
{
return t('Bind GitLab webhook events to Kanboard automatic actions');
}
public function getPluginAuthor()
{
return 'Frédéric Guillot';
}
public function getPluginVersion()
{
return '1.0.6';
}
public function getPluginHomepage()
{
return 'https://github.com/kanboard/plugin-gitlab-webhook';
}
public function getCompatibleVersion()
{
return '>=1.0.37';
}
}