Change passport-github to passport-github2 and @octokit/rest to v18 - #211
Conversation
This library seems popular and claims to use a different auth method that I think will bandaid our current brownout issue. New package: https://github.com/cfsghost/passport-github Deprecation notice: (Links to original notice) https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/
|
Need to test this out. I checked the library and it seemed legit, as in didn't notice anything that seemed bad...can a couple other people double-check? |
|
Wasn't a silver bullet, sadly. |
|
dev_block ☀️ I think this might be needed, but there's more changes needed, as well. |
|
Test Comment -- Webhook |
|
The test comments were to test out comment webhooks. |
|
Some relevant docs: |
|
Thanks @addison-grant for working on this!! |
| "notify-queue": "0.0.5", | ||
| "passport": "^0.4.0", | ||
| "passport-github": "1.1.0", | ||
| "passport-github2": "^0.1.12", |
There was a problem hiding this comment.
I looked through the diff between passport-github and passport-github2, and it looks totally reasonable. I'm not quite sure how hard we want to version lock this; I'm nervous about the fact that this is one semi-random guy's fork.
There was a problem hiding this comment.
(when I say "how hard we want to version lock this", I mean "do we want to use a version like
| "passport-github2": "^0.1.12", | |
| "passport-github2": "0.1.12", |
which won't allow any other version to be used" (although I don't think it prevents malicious uploads over 0.1.12 on NPM).
There was a problem hiding this comment.
The package looks pretty small, actually, looking over at https://github.com/cfsghost/passport-github/tree/master/lib. I wonder if we would want to fork passport-github2, take a little time to understand it, and install from our fork.
| function getCommit(repo, sha) { | ||
| return rateLimit(github.repos.getCommit)(params({ sha }, repo)) | ||
| .then(res => res.data); | ||
| return githubRest.repos.getCommit(params({ ref: sha }, repo)).then(res => res.data); |
There was a problem hiding this comment.
Is the res.data still needed?
There was a problem hiding this comment.
I'm not sure...I'll look into this.
There was a problem hiding this comment.
I think this is still needed because we need the data property off the response. Was there a particular reason you thought we don't need it?
| debug("Getting commit status for %s", ref); | ||
| return rateLimit(github.repos.getCombinedStatusForRef)(params({ ref }, repo)) | ||
| return githubRest.repos.getCombinedStatusForRef(params({ ref }, repo)) | ||
| .then(res => res.data.statuses) |
There was a problem hiding this comment.
Is the res.data still needed here as well?
There was a problem hiding this comment.
same here, will investigate
There was a problem hiding this comment.
I think this is still needed because we need the particular sub-property off the response. Was there a particular reason you thought we don't need it?
|
CR 🐟 through 5dca5e7 |
Co-authored-by: Andrew Gilbert <andrewg@ifixit.com>
We want to keep the colors around because it's a great indication as to how old the pulls are at a glance. Let's match the colors to the preexisting colors that we use on the pull cards. QA: -- Make sure the colors look good
Bumps [url-parse](https://github.com/unshiftio/url-parse) from 1.4.7 to 1.5.1. - [Release notes](https://github.com/unshiftio/url-parse/releases) - [Commits](unshiftio/url-parse@1.4.7...1.5.1) Signed-off-by: dependabot[bot] <support@github.com>
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.5 to 2.8.9. - [Release notes](https://github.com/npm/hosted-git-info/releases) - [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md) - [Commits](npm/hosted-git-info@v2.8.5...v2.8.9) Signed-off-by: dependabot[bot] <support@github.com>
Bumps [underscore](https://github.com/jashkenas/underscore) from 1.9.1 to 1.12.1. - [Release notes](https://github.com/jashkenas/underscore/releases) - [Commits](jashkenas/underscore@1.9.1...1.12.1) Signed-off-by: dependabot[bot] <support@github.com>
…ort-to-alternative-v2
…ort-to-alternative-v2
TODO: update schema
| github = require('./git-manager').github, | ||
| passport = require('passport'), | ||
| _ = require('underscore'), | ||
| GitHubStrategy = require('passport-github').Strategy; |
There was a problem hiding this comment.
test dev_block 👍
hello -Addison
| const getTeamId = github.orgs.getTeams({org: config.github.requireOrg}) | ||
|
|
||
| // `github` here is octokit.rest imported from git-manager | ||
| const getTeamId = github.teams.list({org: config.github.requireOrg}) |
There was a problem hiding this comment.
Trying to test a pull_request_review event
There was a problem hiding this comment.
A single comment on a diff
|
I'm a little worried why there are commits in here from dependabot. I'm gonna look at the commit history. |
|
Update: Those exact commit hashes are already on master and github's diff is just showing the wrong thing. |
New github octokit has new api options and the team stuff no longer requires a teamid and can jut work with the team name.
New api call returns data for single-record requests under the data key. Other endpoints were updated, but this one was missed.
It was using the wrong api after updating to the new octokit.
|
Working on this. Still more to review. |
I think this was introduced accidentally in a recent merge.
The prototype function references a ._then property that didn't exist on github promises, so let's just cast each one to a bluebird promise before calling done.
|
QA 👍 Verified this with @addison-grant ! It lives! |
|
CR 👍 |
This library seems popular and claims to use a different auth method
that I think will bandaid our current brownout issue.
New package: https://github.com/cfsghost/passport-github
Deprecation notice: (Links to original notice)
https://developer.github.com/changes/2020-02-10-deprecating-auth-through-query-param/
Changes made:
passport-githubin favor ofpassport-github2@octokit/restto v18@octokit/rest, the function calls inlib/git-manager.jshad to be updated to reflect the new function calls that call the same endpoints (Change passport-github to passport-github2 and @octokit/rest to v18 #211 (comment)). Also had to update thecheckOrgMembershipRequirementsfunction inlib/authentication.jsrate-limitfunction as the plugin@octokit/plugin-throttlingnow allows for the GitHub API object to throttle itself (https://github.com/octokit/plugin-throttling.js#readme)paginatefunction as@octokit/restv18 now has its own pagination function.QA
You can run
update-pulldasheron cominor with a clone of this repo with this branch checked out, and check out https://pulldasher.cominor.com. Look around pulldasher, let it run throughout the day and make sure the cards reflect the state of their PRs at the end of the day.Associated issue: #210