This is an internal gem at Plataformatec (http://plataformatec.com.br).
We use it to create and delete hooks in our github repositories (like campfire notifications for push and pull_request and CI integration with web push hooks).
user: github_username password: github_personal_access_token_see_below campfire_token: campfire_api_token #optional api_url, default https://api.github.com #api_url: https://mygithubenterprise/api/v3
Then you can use the command
github-hook to list, create email, web and campfire hooks or delete them. Other hooks are not yet implemented (pull requests are appreciated!).
Go to the Authorized Applications page and click "Create new token" under "Personal Access Tokens".
The user specified MUST have administration rights for the repositories you want to set/delete hooks.
The available commands are:
$ github-hook Tasks: github-hook help [TASK] # Describe available tasks or one specific task github-hook list user/repo # List hooks in the given repository github-hook email user/repo events --address=ADDRESS # Add an email hook in the given repository. Events must be separated by commas. github-hook web user/repo events --url=URL # Add a web hook in the given repository. Events must be separated by commas. github-hook campfire user/repo events --room=ROOM --subdomain=SUBDOMAIN # Add a campfire hook in the given repository. Events must be separated by commas. github-hook delete user/repo hook_number # Delete the hook from the given repository
github-hook list plataformatec/devise
github-hook email plataformatec/devise "push" --email@example.com
github-hook web plataformatec/devise "pull_request, push" --url=http://mycallback.com/callback
This creates a new web hook that calls the url specified by
--url. The events that this hooks listens must be the third argument and they must be separeted by commas.
github-hook campfire plataformatec/devise pull_request,push,issue_comment --room="My Room" --subdomain="My Subdomain"
Creates a new campfire hook. The token used for authentication with Campfire must be provided in your
~/.github-hook.yml (see Configuration above).
github-hook delete plataformatec/devise 1010
Deletes the hook 1010 from the given repository. You can get the hook id from the url listed in
github-hook list user/repo.
The available events that github gives us are:
MIT License. Copyright 2012-2014 Plataformatec. http://plataformatec.com.br