GithubHelp home page GithubHelp logo

umayr / hook Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 17 KB

A Github webhook handler primarily to notify about your PRs.

License: MIT License

Makefile 13.77% Go 86.23%
github webhooks golang aws-lambda pushover

hook's Introduction

Hook

A Github webhook handler primarily to notify about your PRs.

Preface

Our team relies on Github PRs and reviews to release new stuff and bug fixes as many teams do; major bottleneck in this scenario is that people don't review quite often even if PRs are assigned to them and they need to nudge about pending reviews. I, personally wouldn't want to be a bottleneck for anybody's dear feature. Github does notify you via email but it usually gets piled up. To resolve this, I initially tried to allocate two slots in my calendar for reviews, it doesn't really work out. So I'm trying something dynamic which works like this:

  • A new review is assigned to me, I get a notification.
  • A new slot for that particular review would be added to my calendar (based on the periods I have provided)
  • No review pending, I wouldn't have anything in my calendar, I would do whatever I have been doing.
  • Any review pending, at least I'd get notification and time allocated.

I just started doing this, so I'm not sure it would make things better for me. This repository has the first part implemented for now, as I'm still testing out the calendar stuff.

Setup

Assuming you've Go set up in your machine:

  # clone the repository
  git clone [email protected]:umayr/hook.git
  
  # make the binary
  make
  
  # create a zip file
  make zip

Deployment

I'm using aws lambda for this, you can use whatever you want but you would have to write server yourself (don't forget to send a PR for that). For lambda you can do something like this:

  aws lambda create-function \
    --region region \
    --function-name lambda-handler \
    --memory 128 \
    --role arn:aws:iam::account-id:role/execution_role \
    --runtime go1.x \
    --zip-file fileb://path-to-your-zip-file/handler.zip \
    --handler lambda-handler

More information could be found here

Notes

This only has implementation to send notification via pushover, if you want to use something else, you can simply create a new notifier, like:

type Whatever struct {}

func (w *Whatever) Notify(title, message string) error {
    // sends notification
    return nil
}

func main() {
    // parse the payload
    p := Parse(payload)
    h := hook.NewHook(p, &Whatever{})
    
    err := h.Perform()
    // handle error
}

hook's People

Contributors

umayr avatar

Stargazers

 avatar

Watchers

 avatar  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.