-
Notifications
You must be signed in to change notification settings - Fork 925
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
/probot homepage #279
/probot homepage #279
Conversation
* origin/master: chore: Read version from package.json feat: Expose public stats about installations (#181) chore: remove changelog now that we are using semantic-release chore: update jsdoc to fix error party machen chore(travis): Run test on node 8 chore: semantic-release setup Move note for robot.log before the @example Added NPM version badge to readme. Changes made in CONTRIBUTING.md according to #271 Update output mentioned in 'Generating a new app' section Smaller image in the welcome PR comment docs: fix log statement Lint JS in examples Whitespace Add @example for using defaultConfig
BREAKING CHANGE: `probot run` without any arguments will no longer autoload apps named `probot-*`.
* refactor-loading: Simplify resolver Update simulate command Look for `apps` key instead of `plugins` Move setup Remove autoloading of plugings Refactor app loading # Conflicts: # index.js
* origin/intro-web-page: Remove duplicate load
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.
@JasonEtco I merged in #284 extracted the default homepage to a built-in app. The diff should look a lot better once #284 is merged.
The page is looking pretty good. It'd be nice to link to documentation and maybe even the slack channel to point people toward places where they can find help building their app.
* origin/master: chore(tests): Migrate to Jest chore(docs): Use GH_TOKEN for updating docs # Conflicts: # package-lock.json
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.
See installation stats
Since this is just a JSON dump right now, what would you think about removing this for now and revisiting in another PR that adds an HTML view of the installation stats?
@bkeepers that's not a bad idea, but EVEN BETTER IDEA: what about including those numbers in the page? Or is that too much for a basic welcome page? Could be done by including the |
@JasonEtco I’d work/discuss showing stats in a follow up PR, this one is quite big already |
Yeah I agree @gr2m. In that case, I'll pull down changes, fix CI and merge away? |
I tested this PR on one of my Probot Test Apps on Glitch, but got this error
Are you still looking into it? Code wise it looks ok, but CI is failing, too. Let me know if you get stuck or when the PR is ready for review |
@gr2m I'm not seeing that error locally, but I'm getting some different CI errors. I'm fairly certain the functionality itself works, its just a testing thing to figure out. I'll let you know if I'm having trouble, thanks 💖 |
It looks like the last failing test is due to the new FAIL test/index.js
● Probot › server › redirects to /probot from /
secretOrPrivateKey must have a value
at Object.<anonymous>.module.exports [as sign] (node_modules/jsonwebtoken/sign.js:70:20)
at generateJwt (node_modules/github-app/index.js:39:16)
at Object.asApp (node_modules/github-app/index.js:7:54)
at Robot.auth (lib/robot.js:148:31)
at getInstallations (lib/plugins/stats.js:29:32)
at refresh (lib/plugins/stats.js:22:33)
at Object.<anonymous>.module.exports (lib/plugins/stats.js:9:26)
at load (index.js:79:5)
at apps.concat.forEach.app (index.js:86:45)
at Array.forEach (<anonymous>)
at Object.setup (index.js:86:30)
at Object.it (test/index.js:47:14)
at Promise (<anonymous>)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7) I'm guessing it has something to do with authenticating the probot instance, but I'm having trouble nailing down the fix. Any ideas @gr2m? cc @bkeepers. By the by @gr2m I did fix your |
Aha! It seems to be the |
Alrighty, per a Slack conversation, it turns out that the reason the last failing test was failing isn't related to this PR and should not be a blocker. The TL;DR of it is that we are missing a way of mocking Certs and things for default plugins, which was causing the I think this is good to merge 🎉 Can I get one last look over @gr2m, @bkeepers, @probot/maintainers? |
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.
Sorry, my fault for breaking the tests. I'm not sure why it wasn't failing for me locally.
As we discussed in #262, it would be really cool to have something if someone visits the
/
path of a running Probot App. @gr2m had a good suggestion to have it redirect to/probot
if there isn't any other set route, which makes a lot of sense. Unfortunately, that creates the challenge of somehow identifying if another route handler for/
has in fact been created.This PR adds a veeeeeery basic
/probot
page (needs work), and the relevant tests to:/probot
responds correctly/
redirects to/probot
/
can be overwritten to no longer redirect to/probot
.1-2 work perfectly, but 3 is a challenge. I've passed one of two relevant tests:
If the newer
.get()
is registered against the Probot App'sserver
, it'll work just fine. However, if the new route is registered as part of anew express.Router
then it is totally ignored 😭 This is made clear in @anglinb's test from #255, which I've copied into this PR.I'd appreciate some help here; I'm stuck on how else to identify if a path has been registered across both the central express app and any nested routers. I thought of writing some methods into therobot
class that would add new routes to an array and then checking that, but that adds a lot of complication around just writing routes.Let me know if you have any questions 💖 Note that this PR is WIP because
I'm stuck and need help 🍕I want your opinions on the way I'm solving this.UPDATE:
I've found a way to overwrite the
/
route by creating aSet()
of routes, and adding all routes in new routers (as a part of theload()
method) to the Set. Then, when/
is requested, it checks the Set to see if it has a route. If it does,next()
, otherwise redirect to/probot
.