Skip to content

chiaweilee/egg-github-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🥚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

// plugin.js
githubWebhook: {
  enable: true,
  package: 'egg-github-webhook',
}
// 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

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');
        }
      }
    }
  };
}

About

🥚Egg plugin for processing GitHub Webhooks.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published