A user-experience-focused middleware for building Gitlab applications. more examples.
Support frameworks: Express / Koa.
-
NO APIS
-
Friendly user experience design
-
Include
.d.ts
, support for automatic completion in editor. -
Semantic actions.
-
install robot:
yarn add cobot
ornpm i cobot
. -
import to your nodejs server:
// express
import cobot, { BotEvents } from 'cobot'
app.use(cobot.express())
// koa2
app.use(cobot.koa())
- set webhook on gitlab:
Settings > integrations > url('http://{yourhost}/{any}') > Add webhook
. you can fill in any api with your nodjes server, robot automatically identifies requests from webhooks.
const bot = cobot.lift()
bot.on(BotEvents.MergeRequest, context => console.log('ok'))
const bot = cobot.lift()
bot.on(BotEvents.IssueOnOpen, context => {
context.actions.reply('thanks your issue')
})
const bot = cobot.lift()
bot.on(BotEvents.MergeRequest, async(context) => {
const notes = await context.actions.findNotes()
console.log(notes)
})
BotEvents = [
'CommentOnIssue',
'CommentOnCommit',
'CommentOnSnippet',
'CommentOnMergeRequest',
'MergeRequest',
'WikiCreate',
'WikiUpdate',
'WikiDelete',
'WikiOnAnyAction',
'PipelineOnRunning',
'PipelineOnPending',
'PipelineOnSuccess',
'PipelineOnFailed',
'PipelineOnCanceled',
'PipelineOnSkipped',
'PipelineOnAnyStatus',
'BuildOnAnyStatus',
'Push',
'Tag',
'IssueOnAnyAction',
'IssueOnOpen',
'IssueOnUpdate',
'IssueOnClose',
'IssueOnReopen',
]