GithubHelp home page GithubHelp logo

rebasebot's Introduction

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

rebasebot's People

Contributors

chrisledet avatar jaggs6 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rebasebot's Issues

Wrong repo on push

Hi,

I would like to use rebasebot on a project, but it seems that rebasebot is (maybe?) trying to push the code on the forked repo instead of the origin repo.
I'm using the docker image:

sudo docker run --restart=always -d --name rebasebot -e "PORT=8080" -e "GITHUB_USERNAME=user" -e "GITHUB_PASSWORD=password" -e "SECRET=secret" -p 8080 chrisledet/rebasebot

I have added the github rebasebot user to the project.

And I'm getting errors:

2016/01/11 14:18:12 git.push.started: /tmp/dylanmei/traefik marathon_uses_port_from_label
2016/01/11 14:18:13 git.push.failed: /tmp/dylanmei/traefik exit status 128
2016/01/11 14:18:13 github.pr.comments.create.started
2016/01/11 14:18:14 github.pr.comments.create.failed status: 404, msg: Not Found 

Did I miss something?

2FA support

Hi,

I tried to install this and I got this error:

2019/06/18 04:25:31 github.find_pr.started
2019/06/18 04:25:31 github.find_pr.failed status:  401
2019/06/18 04:25:31 git.fetch.started: /tmp/rebasebot
2019/06/18 04:25:31 git.fetch.failed: /tmp/rebasebot exit status 128
2019/06/18 04:25:31 git.remote.prune.started: /tmp/rebasebot
2019/06/18 04:25:31 git.remote.prune.failed: /tmp/rebasebot exit status 128
2019/06/18 04:25:31 github.pr.comments.create.started
2019/06/18 04:25:31 github.pr.comments.create.failed status: 401, msg: Must specify two-factor authentication OTP code.

I don't think it is currently possible to configure the Oauth token?

Cheers, J

Replies

rebasebot should reply if it can't rebase

i'm sorry dave i'm afraid i can't do that

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.