Add other interesting events;
This commit is contained in:
parent
37cc889d64
commit
52dbedb1f8
45
index.js
45
index.js
@ -27,10 +27,10 @@ var handlers = {
|
||||
|
||||
push: function(body) {
|
||||
var user = body.user_name;
|
||||
var repoName = body.repository.name;
|
||||
var projectName = body.project.name;
|
||||
var commits = body.commits;
|
||||
|
||||
var msg = ['push on ' + repoName + ': ' + user + ' pushed ' + commits.length + ' commits.'];
|
||||
var msg = ['push on ' + projectName + ': ' + user + ' pushed ' + commits.length + ' commits.'];
|
||||
|
||||
if (commits.length < 4) {
|
||||
msg = msg.concat(commits.map(formatCommit));
|
||||
@ -41,6 +41,47 @@ var handlers = {
|
||||
}
|
||||
|
||||
return msg;
|
||||
},
|
||||
|
||||
issue: function(body) {
|
||||
var user = body.user.name;
|
||||
var projectName = body.project.name;
|
||||
|
||||
var issue = body.object_attributes;
|
||||
var issueNumber = issue.iid;
|
||||
var issueTitle = issue.title;
|
||||
var issueState = issue.state;
|
||||
var url = issue.url;
|
||||
|
||||
var msg = [projectName + ': issue #' + issueNumber + ' has changed state ("' + issueState + '")'];
|
||||
msg.push(issueTitle);
|
||||
msg.push(url);
|
||||
|
||||
return msg;
|
||||
},
|
||||
|
||||
merge_request: function(body) {
|
||||
var user = body.user.name;
|
||||
|
||||
var request = body.object_attributes;
|
||||
|
||||
var from = request.source_branch;
|
||||
var to = request.target_branch;
|
||||
|
||||
var id = request.iid;
|
||||
var title = request.title;
|
||||
var url = request.url;
|
||||
var state = request.state;
|
||||
|
||||
var msg = [projectName + ': merge request (' + from + ':' + to + ') #' + id + ' has changed state ("' + state + '")'];
|
||||
msg.push(title);
|
||||
msg.push(url);
|
||||
},
|
||||
|
||||
build: function(body) {
|
||||
console.log('build event NYI because not documented');
|
||||
console.log(body);
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user