Skip to content

Commit cf52446

Browse files
committed
add whoami
1 parent 2588d5f commit cf52446

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

components/server/ee/src/prebuilds/github-app.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import { Server, Probot, Context } from 'probot';
88
import { getPrivateKey } from '@probot/get-private-key';
99
import * as fs from 'fs-extra';
10-
import { injectable, inject, decorate } from 'inversify';
10+
import { injectable, inject } from 'inversify';
1111
import { Env } from '../../../src/env';
1212
import { AppInstallationDB, TracedWorkspaceDB, DBWithTracing, UserDB, WorkspaceDB } from '@gitpod/gitpod-db/lib';
1313
import * as express from 'express';
@@ -32,8 +32,6 @@ import { Options, ApplicationFunctionOptions } from 'probot/lib/types';
3232
* look at those values to begin with.
3333
*/
3434

35-
decorate(injectable(), Probot)
36-
3735
@injectable()
3836
export class GithubApp {
3937
@inject(AppInstallationDB) protected readonly appInstallationDB: AppInstallationDB;
@@ -82,6 +80,12 @@ export class GithubApp {
8280
res.redirect(301, this.getBadgeImageURL());
8381
});
8482

83+
options.getRouter && options.getRouter('/whoami').get('/', async (req: express.Request, res: express.Response, next: express.NextFunction) => {
84+
const gh = await app.auth();
85+
const data = await gh.apps.getAuthenticated();
86+
res.json(data)
87+
});
88+
8589
app.on('installation.created', async ctx => {
8690
const accountId: string = `${ctx.payload.installation.account.id}`;
8791
const installationId = `${ctx.payload.installation.id}`;

0 commit comments

Comments
 (0)