🐀 A Bot Toolkit for Github!
Clone or download
Latest commit c82c6c2 Oct 4, 2018


Hamster Logo


A Bot Toolkit for Github!


Config The Application:

$ cp config.json config.dist.json

Then add your app_mode, app_port, app_log_level, github_token, github_webhook_secret, repository_author and repository_name

    "app_mode": "prod",
    "app_port": "8080",
    "app_log_level": "info",
    "github_token": "...",
    "github_webhook_secret": "...",
    "repository_author": "Clivern",
    "repository_name": "Hamster"

Add a new webhook from Settings > Webhooks, Set the Payload URL to be https://hamster.com/listen, Content type as JSON and Add Your Webhook Secret.

And then run the application

$ go build squeal.go
$ ./squeal

// OR

$ go run squeal.go

Also running hamster with docker still an option. Just don't forget to update GithubToken, GithubWebhookSecret, RepositoryAuthor and RepositoryName inside docker-compose.yml file. Then run the following stuff

$ docker-compose build
$ docker-compose up -d

Customize the Default Event Listeners:

Anytime github call hamster listen endpoint, there will be a callback that get called with incoming data. For example when you get a status change call from github, the StatusListener(status event.Status) will get called. So do whatever you need inside this callback.

status event: any time a Repository has a status update from the API, The following callback get called.

// plugin/base.go

// Status Action
func StatusListener(status event.Status)(bool, error){
    fmt.Printf("StatusListener Fired: %s \n", status.Sha)
    return true, nil

watch event: any time a User stars a Repository.

// plugin/base.go

// Watch Action
func WatchListener(watch event.Watch)(bool, error){
    fmt.Printf("WatchListener Fired: %s \n", watch.Action)
    return true, nil

issues event: any time an Issue is assigned, unassigned, labeled, unlabeled, opened, edited, milestoned, demilestoned, closed, or reopened.

// plugin/base.go

// Issue Action
func IssuesListener(issues event.Issues)(bool, error){
    fmt.Printf("IssuesListener Fired: %s \n", issues.Action)
    return true, nil

issue_comment event: any time a comment on an issue is created, edited, or deleted.

// plugin/base.go

// Issue Comment Action
func IssueCommentListener(issue_comment event.IssueComment)(bool, error){
    fmt.Printf("IssueCommentListener Fired: %s \n", issue_comment.Action)
    return true, nil

All current supported events and the future events will be available on plugin/base.go. Also it is handy to add aditional callbacks so each event can have any number of callbacks.

Also please check the latest github webhooks guide.

Create a Comment:

// for more info https://developer.github.com/v3/issues/comments/#create-a-comment

import (

github_api := &pkg.GithubAPI{
    Token: os.Getenv("GithubToken"),
    Author: os.Getenv("RepositoryAuthor"),
    Repository: os.Getenv("RepositoryName"),

// Replace Message with the message and 1 with the issue id
created_comment, err := github_api.NewComment("Message", 1)

if err == nil {
    // created_comment.ID
    // check github.com/clivern/hamster/internal/app/response/created_comment.CreatedComment for available data
    // err.Error()


We use google/logger under the hood, make use of it or use these simple functions:

import (

pkg.Info("Info Goes Here!")
pkg.Warning("Warning Goes Here!")
pkg.Error("Error Goes Here!")
pkg.Fatal("Fatal Error Goes Here!")


Build Status GitHub license


  • Version 1.1.1:
Add Logger Package.
  • Version 1.1.0:
Add new events watch, issues and issue_comment.
Fix dockerfile & docker-compose.
  • Version 1.0.0:
Initial Release.


© 2018, Clivern. Released under MIT License.

Hamster is authored and maintained by @clivern.