Public | Automated Build

Last pushed: a year ago
Short Description
Full Description

WIP: muibot


  • Yes


Do stuff

env vars

MUIBOT_PATH # required, default: '/githook'
MUIBOT_PORT # required, default: 8080
MUIBOT_SECRET # required
GITHUB_TOKEN # required

API Reference

<a name="module_muibot"></a>


<a name="exp_module_muibot.boot"></a>

⏏ exports.boot(config) ⇒ <code>Promise</code>

Boot the muibot server

All config parameters default to the env vars detailed in the instructions.

Kind: exports method of <code>muibot</code>
Returns: <code>Promise</code> - Resolves with the server object after booting

Param Type Description
config <code>Object</code>
config.auth.username <code>string</code> Github username
config.auth.token <code>string</code> Github token
config.path <code>string</code> Path to mount the webhook listener on
config.port <code>number</code> Server port to listen on
config.secret <code>string</code>

<a name="module_instructions"></a>


<a name="exp_module_instructions.attachInstructions"></a>

⏏ exports.attachInstructions(instructions)

Attach instructions to an EventEmitter object
emitting Github webhook events using the muibot spec

Kind: exports method of <code>instructions</code>

Param Type
instructions <code>Array.<muibotSpec></code>

<a name="exp_module_instructions.createWebhookHandler"></a>

⏏ exports.createWebhookHandler(config) ⇒ <code>webhookHandler</code>

Creates a function to be bound as a webhook event handler

Kind: exports method of <code>instructions</code>
Returns: <code>webhookHandler</code>

Param Type Description
config <code>Object</code>
config.githubRequest <code>function</code> Github API function
config.conditions <code>function</code> | <code>Object</code> A conditions validation function or key:value object
config.requests <code>Object</code> | <code>Array.<Object></code> A request or array of request definitions

<a name="exp_module_instructions.fetchDependencies"></a>

⏏ exports.fetchDependencies(eventObj, githubRequest) ⇒ <code>Promise</code>

Fetch additional data dependencies for a given
event type required for common conditionals and requests

Kind: exports method of <code>instructions</code>
Returns: <code>Promise</code>

Param Type
eventObj <code>Object</code>
githubRequest <code>function</code>

<a name="exp_module_instructions.evaluateConditions"></a>

⏏ exports.evaluateConditions() ⇒ <code>Promise</code>

Evaluates a conditions object

Kind: exports method of <code>instructions</code>
Returns: <code>Promise</code>

Param Type Description
options.conditions <code>Object</code> A conditions object
options.payload <code>Object</code> Webhook payload

<a name="module_instructions..webhookHandler"></a>

instructions~webhookHandler(event) ⇒ <code>Promise</code>

Handles a webhook payload for the bound instruction set

Kind: inner method of <code>instructions</code>
Returns: <code>Promise</code> - Resolves with the resulting request responses, or false

Param Type
event <code>Object</code>

<a name="module_github"></a>


<a name="exp_module_github.default"></a>

⏏ exports.default(options) ⇒ <code>githubRequest</code>

Creates a Github API client function

Kind: exports method of <code>github</code>
Returns: <code>githubRequest</code>

Param Type Description
options <code>Object</code>
options.auth <code>Object</code> Username and token
options.request <code>Object</code> Override options passed to request

<a name="module_github..githubRequest"></a>

github~githubRequest(options) ⇒ <code>Promise</code>

Executes a github request

Kind: inner method of <code>github</code>
Returns: <code>Promise</code> - Fulfills with the response

Param Type Description
options <code>Object</code>
options.method <code>string</code> GET, POST, DELETE, etc...
options.path <code>string</code> Github path from the API docs
options.body <code>Object</code> Data to send with request
options.payload <code>Object</code> Github webhook payload that triggered the request

Docker Pull Command
Source Repository

Comments (0)