hubot-github-repo-event-notifier icon indicating copy to clipboard operation
hubot-github-repo-event-notifier copied to clipboard

Custom Actions

Open benoror opened this issue 8 years ago • 1 comments

I would like to trigger a custom action on release event type, in order to print the body text & release name with markdown. What's the best approach for overriding eventActions = require('./event-actions/all')

Cheers!

benoror avatar Dec 01 '16 17:12 benoror

Might be related to: https://github.com/hubot-scripts/hubot-github-repo-event-notifier/issues/23

Maybe having a way to override eventActions, would something like this works?:

_ = require('lodash');
//...
eventActions = require('./event-actions/all')
customConsumerActions = require('utils/custom-actions');

_assign(eventActions, customConsumerActions);
//..

Then utils/custom-actions.js would live in the consumer's app file structure & look like this:

export function release(adapter, data, cb) {
    callback(`
      # ${data.action}: ${data.release}
      ${data.release.html_url}
      ---
      ${data.release.body}
    `);
}

Thoughts?

benoror avatar Dec 01 '16 18:12 benoror