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

Setting HUBOT_TEAM_PATH doesn't seem to do anything #1

Open
evansagge opened this issue Jan 12, 2016 · 2 comments
Open

Setting HUBOT_TEAM_PATH doesn't seem to do anything #1

evansagge opened this issue Jan 12, 2016 · 2 comments

Comments

@evansagge
Copy link

No description provided.

@jasonm
Copy link

jasonm commented Mar 24, 2016

Hi @evansagge are you using Slack? I am seeing similar behavior. I'd like to map github mentions of @jasonm to Slack mentions of @jason:

$ heroku config:get HUBOT_TEAM_PATH
hubot-github-comment-notifier-team-config.json

$ cat hubot-github-comment-notifier-team-config.json
{
  "@jasonm": "<@jason>"
}

Here are the hubot logs from adding a new comment:

2016-03-24T19:07:03.769885+00:00 app[web.1]: [Thu Mar 24 2016 19:07:03 GMT+0000 (UTC)] DEBUG Sending to #schools-cr: [minervaproject/schools] New comment on pull request: #1496 Document Multi CDN by jasonm
2016-03-24T19:07:03.769897+00:00 app[web.1]: https://github.com/minervaproject/schools/pull/1496#issuecomment-200974233
2016-03-24T19:07:03.769898+00:00 app[web.1]: @jasonm more fun commenting tests
2016-03-24T19:07:03.769899+00:00 app[web.1]: Mentions: @jasonm
2016-03-24T19:07:03.769900+00:00 app[web.1]:

But the @-mention doesn't appear to be mapping correctly (I'd like it to mention @jason not @jasonm):

screen shot 2016-03-24 at 12 07 31 pm

I've also tried with a config JSON without the angle brackets - e.g. { "@jasonm": "@jason" } but that doesn't seem to help.

We're using the latest version of hubot-slack, 3.4.2:

$ npm list hubot-slack
[email protected] /Users/jason/dev/minerva-hubot
└── [email protected]

which should include slackapi/hubot-slack#193 which enabled @-mentions (Slack apparently requires @-mentions to provide an internal user ID).

Did you end up finding a solution for this?

If not, @yujiosaka any thoughts on what I might do to troubleshoot further?

Thanks!

@jasonm
Copy link

jasonm commented Apr 13, 2016

Ah, I think I've figured out my issue. Since the configuration file is required from node_modules/hubot-github-comment-notifier/lib/index.coffee, I have to set a relative path that points up to the root directory where my configuration file is:

$ heroku run bash
Running bash on minerva-hubot... up, run.2749
~ $ grep "require.*process" node_modules/hubot-github-comment-notifier/lib/index.coffee
team = try require process.env.HUBOT_TEAM_PATH
~ $ echo $HUBOT_TEAM_PATH
../../../hubot-github-comment-notifier-team-config.json
~ $ ls hubot-github-comment-notifier-team-config.json
hubot-github-comment-notifier-team-config.json
~ $ pwd
/app
~ $ exit

Now my mentions map correctly!
I don't know if this is idiomatic or not. My process.env.NODE_PATH is undefined. I guess you could also specify an absolute path, which would not work across local and production environments. Alternatively, if hubot-github-comment-notifier recommends putting this configuration file in your hubot repo root, would it be reasonable to change the require statement in lib/index.coffee to:

team = try require path.join(process.env.PWD, process.env.HUBOT_TEAM_PATH)

?

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

2 participants