facebookarchive / mention-bot

Automatically mention potential reviewers on pull requests.
Other
3.36k stars 271 forks source link

Potential Reviewers always blank when using Github Enterprise #227

Open SxMShaDoW opened 7 years ago

SxMShaDoW commented 7 years ago

Summary:

I am currently trying to use mention-bot with github enterprise and it seems to never return potential reviewers.

Github Enterprise: 2.8 Mention bot: 3.0.2

.mention-bot

(using default config) https://github.com/facebook/mention-bot/blob/master/server.js#L126-L147

package.json

{
  "name": "mention-bot",
  "version": "3.0.2",
  "license": "BSD-3-Clause",
  "repository": "facebook/mention-bot",
  "scripts": {
    "test": "flow && jest",
    "start": "node run-server.js"
  },
  "main": "./run-mention-bot.js",
  "engines": {
    "node": ">=4"
  },
  "jest": {
    "same as master"
  },
  "config": {
  "gheHost": "github.enterprise-url.com",
  "ghePathPrefix": "/api/v3"
 },
  "dependencies": {
    "same as master"
  }
} 

Steps to Reproduce:

Output (which is okay):
There was no GitHub user detected. This is fine, but mention-bot won't work with private repos.
To make mention-bot work with private repos, please expose GITHUB_USER and GITHUB_PASSWORD as environment variables. The username and password must have access to the private repo you want to use.
Listening on Port 5000
Output when webhook is sent

(Verified connectivity from enterprise to mention-bot ):

Reviewers: []
Skipping because there are no reviewers found.
Verified connectivity from mention-bot to enterprise

(changed the default config to use alwaysNotifyForPaths and then it comments on the PR.)

Any recommendations would be great.

cdrage commented 7 years ago

@SxMShaDoW Were you able to solve this? I am experiencing a similar issue.

SxMShaDoW commented 7 years ago

@cdrage - we forked and are troubleshooting it. We also cleaned up a lot of the code to make it more usable. We will submit a PR in the future once we determine the necessary changes (if they are needed) will try to have an update for you in the next few days.

vjeux commented 7 years ago

Awesome, that would be more than welcome!

SxMShaDoW commented 7 years ago

Current implementation of Mention bot's Git Blame tries to display a github page and pull the information directly from it. This works on normal github because you don't need to auth in order to view the screen. Unfortunately this doesn't work on Enterprise if you require auth to view pages.

If you are using GHE 2.10, it may be possible to use the GraphQL api, but since we aren't on that yet, we aren't going that route (probably another few months before we upgrade).

We are looking into creative ways of getting the blame information from using github api (probably a mix of pull requests, history, commits, and users). Also open to other suggestions.

We may submit a PR without this functionality that has a few more toggles added and cleaned up code before then. Will let you know in the near future.