{"id":16698045,"url":"https://github.com/arlac77/koa-github-hook-handler","last_synced_at":"2025-04-10T02:54:37.307Z","repository":{"id":34649774,"uuid":"182044836","full_name":"arlac77/koa-github-hook-handler","owner":"arlac77","description":"handle github/gitea Webhook requests","archived":false,"fork":false,"pushed_at":"2025-04-06T00:05:53.000Z","size":1695,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T00:24:21.612Z","etag":null,"topics":["gitea","github","koa","webhook"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"0bsd","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arlac77.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-18T08:08:22.000Z","updated_at":"2025-04-06T00:05:55.000Z","dependencies_parsed_at":"2023-12-04T16:31:15.017Z","dependency_job_id":"21440a86-52f9-4d25-b755-937e2bca73f4","html_url":"https://github.com/arlac77/koa-github-hook-handler","commit_stats":{"total_commits":661,"total_committers":6,"mean_commits":"110.16666666666667","dds":"0.10590015128593044","last_synced_commit":"5b170f9282336d0bca7964b6d39a775f0e80cd5b"},"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fkoa-github-hook-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fkoa-github-hook-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fkoa-github-hook-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arlac77%2Fkoa-github-hook-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arlac77","download_url":"https://codeload.github.com/arlac77/koa-github-hook-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248147403,"owners_count":21055540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitea","github","koa","webhook"],"created_at":"2024-10-12T17:50:30.879Z","updated_at":"2025-04-10T02:54:37.260Z","avatar_url":"https://github.com/arlac77.png","language":"JavaScript","readme":"[![npm](https://img.shields.io/npm/v/koa-github-hook-handler.svg)](https://www.npmjs.com/package/koa-github-hook-handler)\n[![License](https://img.shields.io/badge/License-0BSD-blue.svg)](https://spdx.org/licenses/0BSD.html)\n[![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript\\\u0026label\\\u0026labelColor=blue\\\u0026color=555555)](https://typescriptlang.org)\n[![bundlejs](https://deno.bundlejs.com/?q=koa-github-hook-handler\\\u0026badge=detailed)](https://bundlejs.com/?q=koa-github-hook-handler)\n[![downloads](http://img.shields.io/npm/dm/koa-github-hook-handler.svg?style=flat-square)](https://npmjs.org/package/koa-github-hook-handler)\n[![GitHub Issues](https://img.shields.io/github/issues/arlac77/koa-github-hook-handler.svg?style=flat-square)](https://github.com/arlac77/koa-github-hook-handler/issues)\n[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Farlac77%2Fkoa-github-hook-handler%2Fbadge\\\u0026style=flat)](https://actions-badge.atrox.dev/arlac77/koa-github-hook-handler/goto)\n[![Styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)\n[![Known Vulnerabilities](https://snyk.io/test/github/arlac77/koa-github-hook-handler/badge.svg)](https://snyk.io/test/github/arlac77/koa-github-hook-handler)\n[![Coverage Status](https://coveralls.io/repos/arlac77/koa-github-hook-handler/badge.svg)](https://coveralls.io/github/arlac77/koa-github-hook-handler)\n\n## koa-github-hook-handler\n\nhandle github/gitea/bitbucket requests\n\n\u003c!-- skip-example --\u003e\n\n```js\nimport Koa from \"koa\";\nimport Router from \"koa-better-router\";\nimport { createGithubHookHandler } from \"koa-github-hook-handler\";\n\n...\n\nconst router = Router();\nconst secret = \"...\";\n\nrouter.addRoute(\n  \"POST\",\n  \"/hook\",\n  createGithubHookHandler(\n    {\n      push: async request =\u003e {\n        console.log(\"PUSH\",request);\n        return { ok: true };\n      }\n    },\n    { secret }\n  )\n);\n```\n\n# API\n\n\u003c!-- Generated by documentation.js. Update this documentation by updating the source code. --\u003e\n\n### Table of Contents\n\n*   [Context](#context)\n*   [KoaHandler](#koahandler)\n    *   [Parameters](#parameters)\n*   [WebhookHandler](#webhookhandler)\n    *   [Parameters](#parameters-1)\n*   [createGithubHookHandler](#creategithubhookhandler)\n    *   [Parameters](#parameters-2)\n*   [createGiteaHookHandler](#creategiteahookhandler)\n    *   [Parameters](#parameters-3)\n*   [createBitbucketHookHandler](#createbitbuckethookhandler)\n    *   [Parameters](#parameters-4)\n\n## Context\n\nType: [Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)\n\n## KoaHandler\n\nType: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\n\n### Parameters\n\n*   `ctx` **[Context](#context)**\u0026#x20;\n*   `next` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)**\u0026#x20;\n\n## WebhookHandler\n\nType: [Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)\n\n### Parameters\n\n*   `request` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** decoded request body\n*   `event` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** from 'x-github-event' header\n*   `ctx` **[Context](#context)** from koa\n\n## createGithubHookHandler\n\nCreate a koa middleware suitable to bridge github webhook requests to KoaHandlers\n\n### Parameters\n\n*   `actions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** holding all the handles for the events (event is the key)\n\n    *   `actions.default` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** default action\n    *   `actions.event` **[WebhookHandler](#webhookhandler)** (event is the key)\n*   `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\u0026#x20;\n\n    *   `config.secret` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to decode signature\n\nReturns **[KoaHandler](#koahandler)** suitable as koa middleware\n\n## createGiteaHookHandler\n\nCreate a koa middleware suitable to bridge gitea webhook requests to KoaHandlers\n\n### Parameters\n\n*   `actions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** holding all the handles for the events (event is the key)\n\n    *   `actions.default` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** default action\n    *   `actions.event` **[WebhookHandler](#webhookhandler)** (event is the key)\n*   `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\u0026#x20;\n\n    *   `config.secret` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to decode signature\n\nReturns **[KoaHandler](#koahandler)** suitable as koa middleware\n\n## createBitbucketHookHandler\n\nCreate a koa middleware suitable to bridge gitea webhook requests to KoaHandlers\n\n### Parameters\n\n*   `actions` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** holding all the handles for the events (event is the key)\n\n    *   `actions.default` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** default action\n    *   `actions.event` **[WebhookHandler](#webhookhandler)** (event is the key)\n*   `config` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)**\u0026#x20;\n\n    *   `config.secret` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** to decode signature\n\nReturns **[KoaHandler](#koahandler)** suitable as koa middleware\n\n# install\n\nWith [npm](http://npmjs.org) do:\n\n```shell\nnpm install koa-github-hook-handler\n```\n\n# license\n\nBSD-2-Clause\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fkoa-github-hook-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farlac77%2Fkoa-github-hook-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farlac77%2Fkoa-github-hook-handler/lists"}