GithubHelp home page GithubHelp logo

nikitashp / eggtimer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dgmltn/eggtimer

0.0 1.0 0.0 8 KB

A GitHub webhook target that merges Pull Requests when they're ready

JavaScript 100.00%

eggtimer's Introduction

EggTimer

A GitHub webhook target that merges Pull Requests when they're ready.

Description

EggTimer runs as a node script, listening to events (webhooks) from your GitHub repositories. It monitors pull requests, pull request reviews, and changes in status. When the pull request is reviews and approved, and 1 or more tests (checks) have been run, and the pull request is mergeable, then boom!, it's merged! Optionally the branch can be deleted at the same time.

This eliminates one of the headaches of a reviewer: the minutes and hours spent waiting for tests to finish after code has been reviewed, to merge in the finished branch.

It's my solution to my own StackOverflow Question

Configuration

EggTimer is meant to be run as a web server, which is then called by GitHub's webhook framework.

Customize config.js

Create a config.js, by cloning config-example.js:

cp config-example.js config.js

Then modify the fields to suit your needs. All fields are required. Here is an explanation of the fields:

Field Description
github_username The GitHub username as which this script will be masquerading.
github_token An auth token generated for the associated github_username, (see documentation). The token needs to have access to repo for writing a comment and merging/deleting branches.
github_webhook_path Path to which the EggTimer webserver should respond, (this needs to be mirrored on the GitHub webhook configuration).
github_webhook_secret Generate a random secret string and use this here and, in the GitHub webhook configuration.
delete_after_merge boolean - Whether a merged commit should be deleted after merge.
port Port of this webserver.

Start webserver

This needs to be a publicly accessible server (or accessible from GitHub's webhooks). Either run it directly:

node eggtimer.js

Or use a process manager (like pm2) to keep it going.

pm2 start eggtimer.js

Hook GitHub

Go to your GitHub project's Settings->Webhooks and "add webhook". The correct "payload URL" will contain your webserver's hostname, port, and github_webhook_path configuration. "Content type" should be application/json and "secret" should match your github_webhook_secret configuration.

The proper webhook events needed are Pull request and Pull request review and Status.

eggtimer's People

Contributors

dgmltn avatar

Watchers

James Cloos avatar

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.