Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/greedbell/github-webhooks

[Developing] Node.js service for processing GitHub Webhooks
https://github.com/greedbell/github-webhooks

Last synced: 21 days ago
JSON representation

[Developing] Node.js service for processing GitHub Webhooks

Awesome Lists containing this project

README

        

# github-webhooks

Node.js service for processing GitHub Webhooks

## Usage

### Dependencies

* node >= 8.0
* npm >= 5.0

### Install

```sh
git clone https://github.com/greedbell/github-webhooks.git
npm install --production
```

### Config

copy `config.example.json` to `config.json`, and edit your `config.json` like

```
[
{
"path": "/callback/example/push-github-webhooks-master",
"secret": "webhook-secret",
"event": "push",
"script": "scripts-example/push.sh"
},
{
"path": "/callback/example/issues-github-webhooks",
"secret": "webhook-secret",
"event": "issues",
"script": "scripts-example/other.sh"
}
]
```

#### path

path for the webhook

#### secret

secret for request

#### event

reference [Event Types & Payloads](https://developer.github.com/v3/activity/events/types/)

* [issues](https://developer.github.com/v3/activity/events/types/#issuesevent)
* [push](https://developer.github.com/v3/activity/events/types/#pushevent)

#### script

script file path to run

### Run

in development

```sh
npm run develop
```

in production

```sh
npm run release
```

test

```
http://localhost:4201/callback/example/push-github-webhooks-master?secret=webhook-secret&ref=ref&payload={"ref":"refs/heads/master"}
```

### Add webhook in GitHub

```
Settings > Webhooks > Add webhook
```

* `Payload URL`: /
* `Content type`: `application/x-www-form-urlencoded`
* `Secret`
* select events

Add webhook