Code Monkey home page Code Monkey logo

pull-to-master's Introduction

What does this project do?

This is a webhook that protects your master branch on GitHub from pushes. Only pull-requests will get into your master branch.

Pushes to master are moved to a branch, then a pull request is automatically created.

How to use it

This is the easy way (that gives me access to anything).

  1. Add pull-to-master-bot as a collaborator to your repository.
  2. Add a webhook with the url https://pull-to-master.herokuapp.com/webhook and payload version of application/vnd.github.v3+json

How to set it up for yourself.

On Heroku

  1. Install Heroku
  2. Clone this application. git clone https://github.com/terite/pull-to-master.git; cd pull-to-master
  3. Create a Heroku app heroku create
  4. Configure. heroku config:set GH_USER=... GH_PASS=...
  5. Push to Heroku git push heroku master

General setup

This project requires a GitHub user to operate as. This can be your own user, or a user created specifically for this webhook.

If you want to use a personal access token as a password, it needs to have scopes repo and public_repo.

Requirements

  • Recent version of node.js.
  • GitHub user with access to your repositories
  • Some Node.js host. I use Heroku, others work too.

Setup

  1. Set environment variables GH_USER and GH_PASS to your github user's username and password. This user needs to have permission to all repositories that it manages.

  2. Run node hook-listener.js Have foreman? instead run foreman start.

How it works

  1. GitHub webhooks lets it know about any pushes.
  2. If push is a pull request merge, allow it. Otherwise, continue to 3.
  3. Make a new branch with pushed commits
  4. Roll back master to previous state.
  5. Make a pull request from new branch to master.

pull-to-master's People

Contributors

terite avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

pull-to-master's Issues

Only allow pull requests based on branch X

I'm not really sure what exactly this feature would look like, but it was mentioned that if you have two long-lived branches, master and production, basing your pull request on master could make cherry picking into production more difficult.

this needs to be investigated and fleshed out

improve pull request copy

  • Notify offending pusher (with @)
  • note about git reset origin/master
  • something about letting someone else review it.

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.