Yet another GitHub webhook thingy
Yet another GitHub Webhook thingy for Node.
var github = require'git-at-me'server = require'express';githubtoken: require'./github-token'user: 'jgable'repo: 'git-at-me'//events: 'push' 'pull_request' 'issues' 'release'// The URL that github will post to; should match your site urlurl: ''// More options for configuration documented belowserver: serveron'push'// Do something with commitson'pull_request'// Do something with PRon'issue'// Do something with issueon'release'// Do something with release;/* **Snip all the express configuration** */serverget'index'resrender'index';;serverlisten;
If you don't pass an
auth value, git-at-me will attempt to create one for you by asking for your GitHub username and password. The username and password are not stored, but the token will be saved to a file that you can require later (defaults to
github-token.js in the current working directory).
If you specify a relative path to a module that exports an API token, it will be used as well.
If you want to do it manually, I've included a simple inquirer driven wizard to help with creating tokens and hooks. This is handy if you don't have access to the Repo you want to add a hook to; just tell the owner of the Repo to run this script to create the necessary web hook.
var gitatme = require'git-at-me';// This will guide you through making a Token and a Hook for your Repo.gitatmewizard;
Check the GitHub API Docs for more information about using the API for authorizations.
By default, git-at-me can create and start an express server, but if you want to pass your own (like from a Hubot.server for instance) you can pass that instead of the server config object.
var github = require'git-at-me';githubtoken: require'./github-token'user: 'jgable'repo: 'git-at-me'events: 'push' 'pull_request' 'issues' 'release'url: ''// Passing port instead of serverport: 3000on'push'// Do something with pushed commits;
Licensed under the MIT License, Copyright 2013-2014 Jacob Gable.