Skip to content

chrisledet/rebasebot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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)'

About

A GitHub bot that rebases your branches

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages