๐Ÿ“ฆ songquanpeng / webhook

Execute predefined commands on your server when receiving a specific HTTP GET request.

โ˜… 13 stars โ‘‚ 0 forks ๐Ÿ‘ 13 watching
webhookwebhook-serverwebhooks-catcher
๐Ÿ“ฅ Clone https://github.com/songquanpeng/webhook.git
HTTPS git clone https://github.com/songquanpeng/webhook.git
SSH git clone git@github.com:songquanpeng/webhook.git
CLI gh repo clone songquanpeng/webhook
Loading files...
๐Ÿ“„ README.md

Webhook Service

Try it in Gitpod now

Build

make

Usage

Cli

You can use ./cli command to run specified command.

Or you can use ./cli to get into the cli's shell and execute commands.

Commands

  • n / new: create new webhook.
  • d / delete id: delete specified webhook.
  • m / modify id: modify existed webhook.
  • e / execute id: execute specified webhook.
  • l / list: list all webhooks.
  • s / search keyword: search webhooks by a keyword in name or description.
  • p / print id: print detail information of specified webhooks.
  • h / help: print help information.
  • q / quit: quit cli shell.

Server

Start server by run ./server or ./server port, the default port is 8080.

Start server with pm2: pm2 start ./server --name webhook-service -- 8080.

User case: update blog when there is a new github commit

  • Firstly you should create a shell script that runs git pull and blog website update command.
  • Then you run the cli to create a new webhook, which executor is the path of the above script.
  • Copy the url from the output and register the webhook in your Github repo's webhook page.
  • Then when you push a new commit to this repo, Github will send a post request to the server which will execute the specified script.