-
Notifications
You must be signed in to change notification settings - Fork 42
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
Feature: Custom Actions #38
base: master
Are you sure you want to change the base?
Conversation
How it works: Simply place your "custom actions" module inside module.exports = {
release: function(adapter, data, cb) {
var res = data.action + ': ' + data.release + '\n';
res += data.release.html_url + '\n'
res += data.release.body;
cb(res);
}
}; (Tested Locally & Heroku) |
eventTypesRaw = process.env['HUBOT_GITHUB_EVENT_NOTIFIER_TYPES'] | ||
eventTypes = [] | ||
customActions = {} | ||
try | ||
customActions = require.main.require('../../../scripts/github/custom-actions') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm concerned about this very narrow path choice – would it be possible to use a user-specified path instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parkr this a relative path to the user's hubot repo, therefore if the repo is called my-hubot
then this particular file (github-repo-event-notifier.coffee
) would be located under:
my-hubot\node_modules\hubot-github-repo-event-notifier\src
Hence the path.
Nevertheless it would be possible to refactor it using built-in "path" api, and let the user specify the last dir/file
part (scripts/github/custom-actions
in this case)
My only question is, where should the user put that configuration?
Cheers!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we always assume that this project will be installed into my-hubot\node_modules\hubot-github-repo-event-notifier\src
? It seems like a very fragile assumption to me as node modules are nested if they are a dependency of a dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@parkr would you be open to use something like findup-sync?
That's the closest thing I found regarding accessing node_module
's parent directories.
Let me know if you are aware of another method/lib, otherwise I can update the PR. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benoror That would make sense. Would it perhaps be better to go around all the automated inclusion (i.e. including this project name in external-scripts.json
)? The user would add it to their package.json
, then write a custom file in scripts/
which includes this project and hooks it up properly for Hubot to include. That way you could add your own handlers without it being really convoluted and "magical."
Fix
#37