Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cobot

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cobot

A user-experience-focused middleware for building Gitlab applications.

  • 0.2.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

cobot

A user-experience-focused middleware for building Gitlab applications. more examples.

Support frameworks: Express / Koa.


Why cobot?

  • NO APIS

  • Friendly user experience design

  • Include .d.ts, support for automatic completion in editor.

  • Semantic actions.


How to use

  1. install robot: yarn add cobot or npm i cobot.

  2. import to your nodejs server:

// express
import cobot, { BotEvents } from 'cobot'
app.use(cobot.express())

// koa2
app.use(cobot.koa())
  1. 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.

Example

1. Print ok when webhook is triggered.
const bot = cobot.lift()
bot.on(BotEvents.MergeRequest, context => console.log('ok'))
2. Reply thanks your issue when a new issue opened.
const bot = cobot.lift()
bot.on(BotEvents.IssueOnOpen, context => {
  context.actions.reply('thanks your issue')
})
3. Use await/async in callback
const bot = cobot.lift()
bot.on(BotEvents.MergeRequest, async(context) => {
  const notes = await context.actions.findNotes()
  console.log(notes)
})
4. Don't worry about interfaces and methods

Support events

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',
]

LICENSE

MIT

FAQs

Package last updated on 03 Jul 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc