Code Monkey home page Code Monkey logo

ghwh's Introduction

ghwh - github webhook handler

This small utility can be used to run commands on push github webhook events.

Install it:

go get -u github.com/artyom/ghwh

Use it:

Usage of ghwh:
  -cert="": path to ssl certificate
  -config="": path to config (yaml)
  -key="": path to ssl certificate key
  -listen="127.0.0.1:8080": address to listen at
  -qsize=10: job queue size

Configuration file example:

/hook1:
  reponame: ghwh
  secret: someSecret
  command: /usr/bin/touch
  args:
    - /tmp/ghwh-updated
  refs:
    "refs/heads/dev":
      command: /usr/bin/touch
      args:
        - /tmp/ghwh-dev-updated
        - /tmp/second-arg

/hook2:
  reponame: bar
  refs:
    "refs/heads/master":
      command: /usr/bin/local/some-script
      args:
        - "--branch=master"

This configuration defines two hook endpoints for two separate repositories. First endpoint mapped to /hook1 and handles hooks for ghwh repository, validating each request against shared secret. For refs/heads/dev ref. command /usr/bin/touch /tmp/ghwh-dev-updated /tmp/second-arg is called, for every other branch command /usr/bin/touch /tmp/ghwh-updated.

Second hook /hook2 handles updates of bar repository and processes only events for refs/heads/master ref., running command /usr/bin/local/some-script --branch=master.

Current implementation runs all commands one by one, queue size can be configured with -qsize flag. This may change in the future.

If both -cert and -key flags set, ghwh tries to use https protocol, otherwise plain http is used. If https is used with self-signed certificates, do not forget to set insecure_ssl=1 while setting up webhook.

ghwh's People

Contributors

artyom avatar

Watchers

 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.