Skip to content

Commit d60f2be

Browse files
committed
Add GitHub integration with installation flow
Introduces GitHub integration endpoints and service, including a Redis-backed state store for secure installation flow. Refactors integration code into modular files, appends GitHub routes to the Express app, and updates tests to import the service from its new location.
1 parent ac36e04 commit d60f2be

File tree

8 files changed

+699
-359
lines changed

8 files changed

+699
-359
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"test:integration:down": "docker compose -f docker-compose.test.yml down --volumes"
2121
},
2222
"devDependencies": {
23-
"@octokit/types": "^16.0.0",
2423
"@shelf/jest-mongodb": "^6.0.2",
2524
"@swc/core": "^1.3.0",
2625
"@types/jest": "^26.0.8",
@@ -48,6 +47,7 @@
4847
"@n1ru4l/json-patch-plus": "^0.2.0",
4948
"@node-saml/node-saml": "^5.0.1",
5049
"@octokit/rest": "^22.0.1",
50+
"@octokit/types": "^16.0.0",
5151
"@types/amqp-connection-manager": "^2.0.4",
5252
"@types/debug": "^4.1.5",
5353
"@types/escape-html": "^1.0.0",

src/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { requestLogger } from './utils/logger';
3131
import ReleasesFactory from './models/releasesFactory';
3232
import RedisHelper from './redisHelper';
3333
import { appendSsoRoutes } from './sso';
34+
import { appendGitHubRoutes } from './integrations/github';
3435

3536
/**
3637
* Option to enable playground
@@ -248,20 +249,26 @@ class HawkAPI {
248249
await redis.initialize();
249250

250251
/**
251-
* Setup shared factories for SSO routes
252-
* SSO endpoints don't require per-request DataLoaders isolation,
252+
* Setup shared factories for SSO and GitHub integration routes
253+
* These endpoints don't require per-request DataLoaders isolation,
253254
* so we can reuse the same factories instance
254255
* Created here to avoid duplication with createContext
255256
*/
256257
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
257-
const ssoDataLoaders = new DataLoaders(mongo.databases.hawk!);
258-
const ssoFactories = HawkAPI.setupFactories(ssoDataLoaders);
258+
const sharedDataLoaders = new DataLoaders(mongo.databases.hawk!);
259+
const sharedFactories = HawkAPI.setupFactories(sharedDataLoaders);
259260

260261
/**
261262
* Append SSO routes to Express app using shared factories
262263
* Note: This must be called after database connections are established
263264
*/
264-
appendSsoRoutes(this.app, ssoFactories);
265+
appendSsoRoutes(this.app, sharedFactories);
266+
267+
/**
268+
* Append GitHub integration routes to Express app using shared factories
269+
* Note: This must be called after database connections are established
270+
*/
271+
appendGitHubRoutes(this.app, sharedFactories);
265272

266273
await this.server.start();
267274
this.app.use(graphqlUploadExpress());

0 commit comments

Comments
 (0)