rebasebot

command module
v0.0.0-...-a4ee06b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2017 License: MIT Imports: 5 Imported by: 0

README

rebasebot Circle CI

A GitHub bot that rebases your pull request branches when you ask

How it works

  1. Make a dedicated GitHub account for the bot
  2. Grant the GitHub account read and write access to your repositories
  3. Setup the bot on your own server
  4. Type a comment "@{github bot username} rebase" in a pull request
  5. The bot will then kick off a rebase and push (if rebase successful) to your repository
  6. You can then delete the comment (in step 4) if you want to, including the rebase comment from the bot.

Dependencies

  • Dedicated host (e.g. EC2, Digital Ocean, Rackspace)
  • Go 1.5
  • Git
  • Dedicated GitHub account

Setup

Download
$ go get github.com/chrisledet/rebasebot
Build
$ cd $GOPATH/src/github.com/chrisledet/rebasebot
$ go build
Install

Make sure $GOPATH/bin is located in your $PATH

$ go install
Configuration

Here are the environment variables rebasebot uses:

  • GITHUB_USERNAME: GitHub username for bot. Required.
  • GITHUB_PASSWORD: GitHub password for bot. Required.
  • PORT: HTTP server port for the bot. Required.
  • TMPDIR: A path to a writable directory. All local copies will live here. Defaults to OS tmp. Strongly recommended.
  • SECRET: A token used to verify web hook requests from GitHub. Strongly recommended.

The GITHUB_* are needed so the bot can post activity updates to GitHub as well as push to accessible Git repositories. Using your personal credentials is not recommended.

Run
$ $GOPATH/bin/rebasebot
Add GitHub Webhook

This is a required step to complete the setup.

  1. Go into your GitHub repository's Webhooks and services page
  2. Add webhook
  3. Enter http://<your host>/rebase in the "Payload URL" field
  4. Content type should be set to "application/json"
  5. Generate a secret token and enter it in "Secret" field
  6. Only send "Issue comment" events. All other ones will be ignored.
  7. GitHub should succesfully ping the service and receive a HTTP 200 OK

Resources

  • GitHub guide for securing your webhooks

  • Generate secret token with Ruby

    $ ruby -rsecurerandom -e 'puts SecureRandom.hex(20)'
    

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package config provides a simple interface for rebasebot configuration
Package config provides a simple interface for rebasebot configuration
Package git provides basic git client functionality
Package git provides basic git client functionality
Package github provides a simple client for the GitHub API
Package github provides a simple client for the GitHub API
Package http implements handlers used by rebasebot http server
Package http implements handlers used by rebasebot http server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL