arlac77/koa-github-hook-handler


handle github/gitea Webhook requests

License: BSD-2-Clause

Language: JavaScript

Keywords: gitea, github, koa, webhook


styled with prettier Known Vulnerabilities Commitizen friendly npm License minified size downloads GitHub Issues Build Status codecov.io Coverage Status Greenkeeper semantic-release

koa-github-hook-handler

handle github/gitea/bitbucket requests

import Koa from "koa";
import Router from "koa-better-router";
import { createGithubHookHandler } from "koa-github-hook-handler";

...

const router = Router();
const secret = "...";

router.addRoute(
  "POST",
  "/hook",
  createGithubHookHandler(
    {
      push: async request => {
        console.log("PUSH",request);
        return { ok: true };
      }
    },
    { secret }
  )
);

API

Table of Contents

KoaHandler

Type: Function

Parameters

WebhookHandler

Type: Function

Parameters

  • request Object decoded request body
  • event string from 'x-github-event' header
  • ctx Context from koa

createGithubHookHandler

Create a koa middleware suitable to bridge github webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)
  • config Object (optional, default {})
    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

createGiteaHookHandler

Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)
  • config Object (optional, default {})
    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

createBitbucketHookHandler

Create a koa middleware suitable to bridge gitea webhook requests to KoaHandlers

Parameters

  • actions Object holding all the handles for the events (event is the key)
  • config Object (optional, default {})
    • config.secret string to decode signature

Returns KoaHandler suitable as koa middleware

install

With npm do:

npm install koa-github-hook-handler

license

BSD-2-Clause

Project Statistics

Sourcerank 4
Repository Size 113 KB
Stars 0
Forks 1
Watchers 1
Open issues 0
Dependencies 11
Contributors 2
Tags 11
Created
Last updated
Last pushed

Top Contributors See all

Markus Felten greenkeeper[bot]

Packages Referencing this Repo

koa-github-hook-handler
handle github/gitea/bitbucket webhook requests
Latest release 1.4.4 - Updated

Recent Tags See all

v1.4.4 January 08, 2020
v1.4.3 October 15, 2019
v1.4.2 September 28, 2019
v1.4.1 September 16, 2019
v1.4.0 July 18, 2019
v1.3.1 July 15, 2019
v1.3.0 May 19, 2019
v1.2.0 May 19, 2019
v1.1.0 May 07, 2019
v1.0.1 May 04, 2019
v1.0.0 April 18, 2019

Something wrong with this page? Make a suggestion

Last synced: 2020-01-08 04:03:48 UTC

Login to resync this repository