Starting point for registering event handlers and handling payloads coming from github webhooks. Allows usage of plugins to extend functionality for individual implementations.
The main purpose of this module is to create a starting point for registering github webhook event handlers and triggering the handlers with a payload.
The actual web server pieces of handling github webhooks are not included in this module. See related-projects for usage with web servers and other implementations.
(TOC generated by verb)
Install
Install with npm
$ npm i githubbot --save
Usage
var bot = ;
API
GithubBot
Create a new instance of a GithubBot with provided options.
Params
options
{Object}: Options to configure the github bot.
Example
var bot = ;
Events
Array of event types from https://developer.github.com/v3/activity/events/types/
commit-comment
Github webhook commit-comment
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onCommitComment(fn)
method.
Handle events by calling the .handleCommitComment(payload)
method.
// listen for commit-comment events.bot; // handle a payload for the commit-comment event.bot;
create
Github webhook create
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onCreate(fn)
method.
Handle events by calling the .handleCreate(payload)
method.
// listen for create events.bot; // handle a payload for the create event.bot;
delete
Github webhook delete
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onDelete(fn)
method.
Handle events by calling the .handleDelete(payload)
method.
// listen for delete events.bot; // handle a payload for the delete event.bot;
deployment
Github webhook deployment
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onDeployment(fn)
method.
Handle events by calling the .handleDeployment(payload)
method.
// listen for deployment events.bot; // handle a payload for the deployment event.bot;
deployment-status
Github webhook deployment-status
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onDeploymentStatus(fn)
method.
Handle events by calling the .handleDeploymentStatus(payload)
method.
// listen for deployment-status events.bot; // handle a payload for the deployment-status event.bot;
download
Github webhook download
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onDownload(fn)
method.
Handle events by calling the .handleDownload(payload)
method.
// listen for download events.bot; // handle a payload for the download event.bot;
follow
Github webhook follow
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onFollow(fn)
method.
Handle events by calling the .handleFollow(payload)
method.
// listen for follow events.bot; // handle a payload for the follow event.bot;
fork
Github webhook fork
event. Find more information about the payload for this event here.
Listen for this event registering a handler the .onFork(fn)
method.
Handle events by calling the .handleFork(payload)
method.
// listen for fork events.bot; // handle a payload for the fork event.bot;
fork-apply
Github webhook fork-apply
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onForkApply(fn)
method.
Handle events by calling the .handleForkApply(payload)
method.
// listen for fork-apply events.bot; // handle a payload for the fork-apply event.bot;
gist
Github webhook gist
event. Find more information about the payload for this event here.
Listen for this event registering a handler the .onGist(fn)
method.
Handle events by calling the .handleGist(payload)
method.
// listen for gist events.bot; // handle a payload for the gist event.bot;
gollum
Github webhook gollum
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onGollum(fn)
method.
Handle events by calling the .handleGollum(payload)
method.
// listen for gollum events.bot; // handle a payload for the gollum event.bot;
issue-comment
Github webhook issue-comment
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onIssueComment(fn)
method.
Handle events by calling the .handleIssueComment(payload)
method.
// listen for issue-comment events.bot; // handle a payload for the issue-comment event.bot;
issues
Github webhook issues
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onIssues(fn)
method.
Handle events by calling the .handleIssues(payload)
method.
// listen for issues events.bot; // handle a payload for the issues event.bot;
member
Github webhook member
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onMember(fn)
method.
Handle events by calling the .handleMember(payload)
method.
// listen for member events.bot; // handle a payload for the member event.bot;
membership
Github webhook membership
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onMembership(fn)
method.
Handle events by calling the .handleMembership(payload)
method.
// listen for membership events.bot; // handle a payload for the membership event.bot;
page-build
Github webhook page-build
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onPageBuild(fn)
method.
Handle events by calling the .handlePageBuild(payload)
method.
// listen for page-build events.bot; // handle a payload for the page-build event.bot;
public
Github webhook public
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onPublic(fn)
method.
Handle events by calling the .handlePublic(payload)
method.
// listen for public events.bot; // handle a payload for the public event.bot;
pull-request
Github webhook pull-request
event. Find more information about the payload for this event here.
Listen for this event registering a handler with on-puthe
.on-pull-request(fn)method. Handle events by calling the
.handle-pull-request(payload)` method.
// listen for pull-request events.bot; // handle a payload for the pull-request event.bot;
pull-request-review-comment
Github webhook pull-request-review-comment
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onPullRequestReviewComment(fn)
method.
Handle events by calling the .handlePullRequestReviewComment(payload)
method.
// listen for pull-request-review-comment events.bot; // handle a payload for the pull-request-review-comment event.bot;
push
Github webhook push
event. Find more information about the payload for this event here.
Listen for this event registering a handler the .onPush(fn)
method.
Handle events by calling the .handlePush(payload)
method.
// listen for push events.bot; // handle a payload for the push event.bot;
release
Github webhook release
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onRelease(fn)
method.
Handle events by calling the .handleRelease(payload)
method.
// listen for release events.bot; // handle a payload for the release event.bot;
repository
Github webhook repository
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onRepository(fn)
method.
Handle events by calling the .handleRepository(payload)
method.
// listen for repository events.bot; // handle a payload for the repository event.bot;
status
Github webhook status
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onStatus(fn)
method.
Handle events by calling the .handleStatus(payload)
method.
// listen for status events.bot; // handle a payload for the status event.bot;
team-add
Github webhook team-add
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onTeamAdd(fn)
method.
Handle events by calling the .handleTeamAdd(payload)
method.
// listen for team-add events.bot; // handle a payload for the team-add event.bot;
watch
Github webhook watch
event. Find more information about the payload for this event here.
Listen for this event registering a handler with the .onWatch(fn)
method.
Handle events by calling the .handleWatch(payload)
method.
// listen for watch events.bot; // handle a payload for the watch event.bot;
Related projects
- base-bot: Simple bot that knows how to handle events when told too. Use base bot to… more | homepage
- base-methods: base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… more | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Brian Woodward
License
Copyright © 2015 Brian Woodward Released under the MIT license.
This file was generated by verb on December 23, 2015.