https://github.com/chiaweilee/egg-github-webhook
🥚Egg plugin for processing GitHub Webhooks.
https://github.com/chiaweilee/egg-github-webhook
egg egg-plugin github webhooks
Last synced: about 2 months ago
JSON representation
🥚Egg plugin for processing GitHub Webhooks.
- Host: GitHub
- URL: https://github.com/chiaweilee/egg-github-webhook
- Owner: chiaweilee
- License: mit
- Created: 2019-07-12T00:39:58.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-10-24T23:35:27.000Z (over 6 years ago)
- Last Synced: 2025-05-17T23:39:26.248Z (about 1 year ago)
- Topics: egg, egg-plugin, github, webhooks
- Language: TypeScript
- Homepage:
- Size: 19.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [egg-github-webhook](#) · [](https://github.com/chiaweilee/egg-github-webhook/blob/master/LICENSE) [](https://www.npmjs.com/package/egg-github-webhook) [](https://npmcharts.com/compare/egg-github-webhook?minimal=true) [](#)
🥚Egg plugin for processing GitHub Webhooks.
## Installation
```
npm install egg-github-webhook
```
## BeforeUse
*Content type must be `application/json`, `application/x-www-form-urlencoded` won't work at present.*
## Usage
```js
// plugin.js
githubWebhook: {
enable: true,
package: 'egg-github-webhook',
}
```
```js
// config.default.js
githubWebhook: {
path: '/',
secret: 'your-github-webhook-password',
event: {
// a js path
push: './scripts/githook.js',
// or a function
push: function (event) {
// do sth
},
}
}
```
*tips: It is possiable to use YAML.*
## Options
option | intro | type | default | |
-|-|-|-
path | Path of Payload URL | string | |
secret | secret | string | |
event | event object | object | object | |
## Example
```js
event: {
push: function(event) {
if (event.payload) {
const { ref, commits } = event.payload;
if (ref === 'refs/heads/master') {
if (!commits.every(commit => commit.message !== 'build: release')) {
cmd.run('git pull');
}
}
}
};
}
```