Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin API #4

Closed
bkeepers opened this issue Oct 7, 2016 · 1 comment
Closed

Plugin API #4

bkeepers opened this issue Oct 7, 2016 · 1 comment

Comments

@bkeepers
Copy link
Contributor

bkeepers commented Oct 7, 2016

Before the first release, there should be a clearly defined plugin API and easy way to create new behaviors as node packages. The plugin API should have convenience methods for performing common actions on the item that triggered the event (e.g. comment on a PR, update statuses, apply labels, etc.).

The naive example in the README right now is something like this:

robot.on('pull', function(event) {
  robot.comment("Thanks for the pull request! We'll review it within 72 hours!");
});

The first behavior is looking something like this:

module.exports = {
  webhook: 'issues', // name of webhook event
  action: function(event, github) {
    // event - the webhook event
    // github - API client: https://mikedeboer.github.io/node-github/
  }
};

I'm planning to implement a few other behaviors before figuring out what the API should look like.

@bkeepers
Copy link
Contributor Author

Here's the new plugin API:

module.exports = robot => {
  robot.on('push', event => console.log(event));
};

Which you run with

$ probot ./index.js

🎩 @groundwater

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant