core/integrations/github/src/account-create.ts
Harshith Mullapudi 4882f227d2
Feat: clusters (#37)
* Feat: clustering fact statements

* Feat: cluster drift

* Feat: add recall count and model to search

* Feat: Github integration

* Fix: clustering UI

* Improve graph

* Bump: new version

---------

Co-authored-by: Manoj K <saimanoj58@gmail.com>
2025-08-05 15:31:15 +05:30

38 lines
890 B
TypeScript

import { getGithubData } from './utils';
export async function integrationCreate(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any,
) {
const { oauthResponse } = data;
const integrationConfiguration = {
refresh_token: oauthResponse.refresh_token,
access_token: oauthResponse.access_token,
};
const user = await getGithubData(
'https://api.github.com/user',
integrationConfiguration.access_token,
);
return [
{
type: 'account',
data: {
settings: {
login: user.login,
username: user.login,
schedule: {
frequency: '*/15 * * * *',
},
},
accountId: user.id.toString(),
config: {
...integrationConfiguration,
mcp: { tokens: { access_token: integrationConfiguration.access_token } },
},
},
},
];
}