Skip to content

Commit f917118

Browse files
authored
gitLab MRs collected (#36)
1 parent 09e6ad9 commit f917118

File tree

1 file changed

+20
-2
lines changed
  • packages/integrations/source-control/src/gitlab

1 file changed

+20
-2
lines changed

packages/integrations/source-control/src/gitlab/index.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class GitlabSourceControl implements SourceControl {
99
constructor(token: string) {
1010
this.api = new Gitlab({
1111
token,
12-
camelize: true,
12+
// camelize: true
1313
});
1414
}
1515

@@ -32,6 +32,24 @@ export class GitlabSourceControl implements SourceControl {
3232

3333
// eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/require-await
3434
async fetchMergeRequests(externalRepositoryId: number, namespaceName: string, repositoryName: string, page?: number, perPage?: number): Promise<{ mergeRequests: NewMergeRequest[], pagination: Pagination }> {
35-
throw new Error('Method not implemented.');
35+
const { data, paginationInfo } = await this.api.MergeRequests.all({
36+
projectId: externalRepositoryId,
37+
page,
38+
perPage,
39+
pagination: 'offset',
40+
showExpanded: true
41+
});
42+
return {
43+
mergeRequests: data.map((mr) => ({
44+
externalId: mr.id,
45+
mergeRequestId: mr.iid,
46+
repositoryId: externalRepositoryId
47+
})),
48+
pagination: {
49+
page: paginationInfo.current,
50+
perPage: paginationInfo.perPage,
51+
totalPages: paginationInfo.totalPages
52+
}
53+
}
3654
}
3755
}

0 commit comments

Comments
 (0)