GithubHelp home page GithubHelp logo

superhyp / go-webhook-server Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miguelmota/go-webhook-server

0.0 0.0 0.0 2.38 MB

A simple server to receive webhooks and execute commands

Home Page: https://github.com/miguelmota/go-webhook-server

License: MIT License

Shell 11.45% Go 77.43% Makefile 7.81% Dockerfile 3.31%

go-webhook-server's Introduction

go-webhook-server

A simple server to receive webhooks and execute commands

License Build Status Go Report Card GoDoc

Install

Installing from Go:

$ go get -u github.com/miguelmota/go-webhook-server/cmd/gws

Installing pre-compiled binary:

$ wget https://github.com/miguelmota/go-webhook-server/releases/download/v0.0.9/gws_0.0.9_Linux_x86_64.tar.gz
$ tar -xvzf gws_0.0.9_Linux_x86_64.tar.gz gws
$ chmod +x gws
$ sudo mv gws /usr/local/bin/gws

Usage

$ gws --help

Getting started

Example of setting up a Github webhook:

$ export SECRET_TOKEN=mysecret
$ gws -port=8080 -path=/postreceive -command='echo "hello world"'

Method: GET
Path: /postreceive
Command: echo "hello world"
Listening on port 8080
$ curl "http://localhost:8080/postreceive" -X 'X-Hub-Signature: sha1=33f9d709782f62b8b4a0178586c65ab098a39fe2'
hello world

Example of how to use bash script as the command:

$ cat > command.sh
#!/bin/bash
echo 'hello world'
^C

$ chmod +x command.sh

$ gws -path=/postreceive -command=$(pwd)/command.sh

Example of how to read the payload in bash:

$ cat > command.sh
#!/bin/bash

payload=$(</dev/stdin)

echo $payload | jq '.' | cat
^C

$ gws -method=POST -command=$(pwd)/command.sh

License

MIT

go-webhook-server's People

Contributors

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