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

refactor(probot)!: upgrade gcf-utils to probot@10, @octokit/rest@18 #963

Merged
merged 10 commits into from
Sep 29, 2020

Conversation

bcoe
Copy link
Contributor

@bcoe bcoe commented Sep 18, 2020

First pass at an attempt to get us on the latest version of probot, this is going to be somewhat gnarly.

@bcoe bcoe requested a review from a team September 18, 2020 21:41
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Sep 18, 2020
@@ -51,7 +52,7 @@
"mocha": "^8.0.0",
"nock": "^13.0.0",
"sinon": "^9.0.0",
"sonic-boom": "^1.0.1",
"sonic-boom": "1.1.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the point release of sonic-boom breaks types.

Copy link
Contributor Author

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sofisl/@gr2m take a look 😄

@gr2m thanks for your help planning this upgrade so far 👏

app.on('schedule.repository', spy);
app.on('err', sinon.stub().throws());
// eslint-disable-next-line @typescript-eslint/no-explicit-any
app.on('schedule.repository' as any, spy);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Octokit is now strict about event names, I've been talking to @gr2m about how we might approach this going forward.

packages/gcf-utils/src/gcf-utils.ts Show resolved Hide resolved
// TODO: How do we still get access to this installation token?
async getAuthenticatedOctokit(installationId: number): Promise<Octokit> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const app = (this.probot as any).apps[0] as Application;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gr2m I think this is what we talked about earlier today, that can be used to give us an Octokit instance with permission to call octokit.apps.listReposAccessibleToInstallation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry for the need of this ugly hack, I hope make it obsolete soon

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so we don't lose track, @bcoe could I trouble you to file an upstream bug and leave it in a comment here so we can come clean up?

packages/gcf-utils/src/gcf-utils.ts Outdated Show resolved Hide resolved
packages/gcf-utils/src/gcf-utils.ts Show resolved Hide resolved
// TODO: How do we still get access to this installation token?
async getAuthenticatedOctokit(installationId: number): Promise<Octokit> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const app = (this.probot as any).apps[0] as Application;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, sorry for the need of this ugly hack, I hope make it obsolete soon

Co-authored-by: Gregor Martynus <gregor@martynus.net>
@google-cla
Copy link

google-cla bot commented Sep 24, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 24, 2020
@bcoe bcoe added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 24, 2020
@bcoe
Copy link
Contributor Author

bcoe commented Sep 24, 2020

@gr2m thank you for the review.

@google-cla
Copy link

google-cla bot commented Sep 29, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 29, 2020
@google-cla
Copy link

google-cla bot commented Sep 29, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@bcoe bcoe added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 29, 2020
@google-cla
Copy link

google-cla bot commented Sep 29, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot removed the cla: yes This human has signed the Contributor License Agreement. label Sep 29, 2020
@google-cla google-cla bot added the cla: no This human has *not* signed the Contributor License Agreement. label Sep 29, 2020
@bcoe bcoe added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 29, 2020
@google-cla
Copy link

google-cla bot commented Sep 29, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no This human has *not* signed the Contributor License Agreement. and removed cla: yes This human has signed the Contributor License Agreement. labels Sep 29, 2020
// TODO: How do we still get access to this installation token?
async getAuthenticatedOctokit(installationId: number): Promise<Octokit> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const app = (this.probot as any).apps[0] as Application;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just so we don't lose track, @bcoe could I trouble you to file an upstream bug and leave it in a comment here so we can come clean up?

});
sinon
.stub(bootstrapper, 'getAuthenticatedOctokit')
.returns(Promise.resolve(new Octokit()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shorten to .resolves(new Octokit())

@@ -190,7 +197,8 @@ export = (app: Application) => {
}
});

app.on('schedule.repository', async context => {
// See: https://github.com/octokit/webhooks.js/issues/277
app.on('schedule.repository' as any, async context => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to keep the build clean, please address the warnings here

@@ -16,8 +16,18 @@ import myProbotApp from '../src/release-please';
import {Runner} from '../src/runner';
import {describe, it, beforeEach} from 'mocha';
import {resolve} from 'path';

// We provide our own GitHub instnace, similar to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo in instnace :)

)
.reply(200, {content: config.toString('base64')});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is gonna break stuff in other bots

Comment on lines 358 to 359
// see: https://github.com/probot/probot/issues/1367
name: 'pull_request.labeled' as any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove .labeled from the name. labeled is the action, it is part of the payload:

Suggested change
// see: https://github.com/probot/probot/issues/1367
name: 'pull_request.labeled' as any,
name: 'pull_request',

Comment on lines 374 to 375
// see: https://github.com/probot/probot/issues/1367
name: 'pull_request.labeled' as any,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// see: https://github.com/probot/probot/issues/1367
name: 'pull_request.labeled' as any,
name: 'pull_request',

@google-cla
Copy link

google-cla bot commented Sep 29, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@bcoe bcoe added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Sep 29, 2020
@bcoe bcoe changed the title chore(probot): update dependencies refactor(probot)!: upgrade gcf-utils to probot@10, @octokit/rest@18 Sep 29, 2020
@bcoe bcoe merged commit a601f4a into master Sep 29, 2020
@release-please release-please bot mentioned this pull request Sep 29, 2020
@bcoe bcoe deleted the attempt-upgrade branch September 29, 2020 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants