@lskjs/bots-plugin-notify
Version:
LSK.js plugin for @lskjs/bots module for telegram, slack, discord, whatsapp, twitter, instagram and vk bots creation
55 lines (42 loc) • 1.42 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.github = github;
exports["default"] = void 0;
var _build = require("./build");
var _mergeRequest = require("./mergeRequest");
var _pipeline = require("./pipeline");
var _push = require("./push");
function github(message, project, bot) {
var _project$gitlab, _project$github;
if (this !== null && this !== void 0 && this.debug) this.log.trace('github.message', message);
var event = message.event;
var _message$meta = message.meta,
objectAttributes = _message$meta.object_attributes,
buildStatus = _message$meta.build_status;
if (event === 'pipeline' && (_project$gitlab = project.gitlab) !== null && _project$gitlab !== void 0 && _project$gitlab["pipeline__".concat(objectAttributes.status)]) {
return {
msg: (0, _pipeline.pipeline)(message, bot)
};
}
if (event === 'build' && (_project$github = project.github) !== null && _project$github !== void 0 && _project$github["build__".concat(buildStatus)]) {
return {
msg: (0, _build.build)(message, bot)
};
}
if (event === 'pull_request') {
return {
msg: (0, _mergeRequest.mergeRequest)(message, bot)
};
}
if (event === 'push') {
return {
msg: (0, _push.push)(message, bot)
};
}
return null;
}
var _default = github;
exports["default"] = _default;
//# sourceMappingURL=index.js.map
;