ewolfe / prlint

GitHub App for linting pull request meta data
https://github.com/apps/prlint
MIT License
126 stars 9 forks source link

feat: Make it a probot app ✨ #96

Open mrchief opened 5 years ago

mrchief commented 5 years ago

Fixes #85

mrchief commented 5 years ago

Should be good to go now. I copied existing logic into createFinalReport but I'd appreciate if you can verify those core pieces (lint + createFinalReport). If we can verify those 2 are doing what they are doing in current prod implementation, then this PR should be good to merge.

ewolfe commented 5 years ago

@mrchief I probably won't get to spend anytime on this today. But I'll outline steps in case you want to get a jumpstart on testing it:

  1. Accept the GitHub org invite https://github.com/prlint
  2. Configure the permissions in the new staging app to match the existing app https://github.com/organizations/prlint/settings/apps/prlint-staging/permissions
  3. Deploy this branch to https://prlint-staging.now.sh/webhook (or anywhere, really)
  4. Install the prlint-staging app on a repo (a new sandbox repo in the prlint github org) and verify
  5. Merge this branch if all goes well
mrchief commented 5 years ago

@ewolfe Sounds like a plan. Will keep you posted.

mrchief commented 5 years ago

Tried creating a now deployment but things weren't going well. After banging my head in frustration, I found this: https://github.com/probot/probot.github.io/issues/273

now doesn't let you create v1 deployments anymore. I created a v2 now.json

{
  "name": "prlint",
  "version": 2,
  "alias": "prlint-staging",
  "env": {
    "PRIVATE_KEY": "@prlint-private-key",
    "WEBHOOK_SECRET": "@prlint-webhook-secret",
    "NODE_ENV": "production"
  },
  "builds": [
    {
      "src": "*.js",
      "use": "@now/node"
    }
  ],
  "routes": [
    {
     "src": "/", "dest": "index.js"
    }
  ],
  "regions": [
    "all"
  ]
}

but it seems like we need that wrapper for things to work properly. Looks like Probot docs would need an update too. Will continue looking into this...

ewolfe commented 5 years ago

Oh no! That sounds like it was probably really frustrating. I can help investigate over the weekend too.

mrchief commented 5 years ago

You bet! 3 hours of head-banging fun! I also tried the serverless-lambda but that resulted in Error: Cannot find module '/var/task/user/package' error. I'm going to give it a spin in a real AWS lambda (and not via now) to see if it makes any difference.

mrchief commented 5 years ago

I tried with AWS lambda and here's what I found:

So based on these, I think we can do one of these:

Thoughts?

mrchief commented 5 years ago

@ewolfe Did you get a chance to look at it yet?

mrchief commented 5 years ago

@ewolfe Any update on this? I can merge this but I don't have access to the deployment service (now.sh I believe?).

If you can add me there, then I can test and get this version uploaded.

ewolfe commented 5 years ago

@mrchief sorry for the delay. Yeah let's get this wrapped up! Can you signup with this URL https://zeit.co/teams/invite/qDB2l5r6 and then try deploying to https://prlint-staging.now.sh/ ?

mrchief commented 5 years ago

Great! I signed up but I wasn't able to install Now on prlint (complains that I'm not an owner which is weird). I'll try later via the cli.

I'll ping you on spectrum if needed. Don't want to bog down this PR thread with side chatter.

ewolfe commented 5 years ago

@mrchief can you try installing it on https://github.com/prlint/prlint-staging ? I want to move this repo over to https://github.com/prlint/prlint as part of this whole update as well

mrchief commented 5 years ago

@mrchief can you try installing it on prlint/prlint-staging

I believe that is where I tried. But I'll check again tonight.

mrchief commented 5 years ago

Was able to sort thru issues. Did a test deployment at https://prlint-staging.mrchief.now.sh/ so I know integration etc. is now all setup correctly.

I'm going to start cleaning up this PR now.