Skip to content

Commit c63a1b9

Browse files
authored
Github integration paging problem (#245)
1 parent 1c03860 commit c63a1b9

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

backend/src/serverless/integrations/services/integrations/githubIntegrationService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ export class GithubIntegrationService extends IntegrationServiceBase {
229229
throw new Error(`Unknown event '${event}'!`)
230230
}
231231

232+
const nextPageStream = result.hasPreviousPage
233+
? { value: stream.value, metadata: { repo: stream.metadata.repo, page: result.startCursor } }
234+
: undefined
235+
232236
const activities = await GithubIntegrationService.parseActivities(result.data, stream, context)
233237

234238
return {
@@ -239,6 +243,7 @@ export class GithubIntegrationService extends IntegrationServiceBase {
239243
},
240244
],
241245
newStreams,
246+
nextPageStream,
242247
}
243248
}
244249

backend/src/serverless/integrations/usecases/github/graphql/organizations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ const getOrganization = async (name: string, token: string): Promise<any> => {
1616
},
1717
})
1818

19+
const sanitizedName = name.replaceAll('\\', '')
20+
1921
const organizationsQuery = `{
20-
search(query: "type:org ${name}", type: USER, first: 10) {
22+
search(query: "type:org ${sanitizedName}", type: USER, first: 10) {
2123
nodes {
2224
... on Organization ${BaseQuery.ORGANIZATION_SELECT}
2325
}

backend/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"allowSyntheticDefaultImports": true,
44
"resolveJsonModule": true,
55
"esModuleInterop": true,
6-
"lib": ["es2017", "dom"],
6+
"lib": ["es2017", "dom", "ES2021.String"],
77
"module": "commonjs",
88
"moduleResolution": "node",
99
"noUnusedLocals": false,

0 commit comments

Comments
 (0)