Skip to content

Commit b02282b

Browse files
committed
feat: enhanced pipeline details
To be compatible with all Gitlab version uses complete pipeline object
1 parent 5da733e commit b02282b

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

src/api/GitlabCIClient.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,27 @@ export class GitlabCIClient implements GitlabCIApi {
4444
async getPipelineSummary(
4545
projectID?: string,
4646
): Promise<PipelineSummary | undefined> {
47-
const pipelineObjects = await this.callApi<PipelineObject[]>(
48-
'projects/' + projectID + '/pipelines',
49-
{},
50-
);
51-
let projectObj: any = await this.callApi<Object>(
52-
'projects/' + projectID,
53-
{},
54-
);
55-
if (pipelineObjects) {
56-
pipelineObjects.forEach((element: PipelineObject) => {
57-
element.project_name = projectObj?.name;
58-
});
59-
}
47+
48+
const [pipelines, projectObj] = await Promise.all([
49+
this.callApi<PipelineObject[]>(
50+
'projects/' + projectID + '/pipelines',
51+
{},
52+
),
53+
this.callApi<Object>(
54+
'projects/' + projectID,
55+
{},
56+
)
57+
]);
58+
59+
const pipelineObjects: PipelineObject[] = await Promise.all(pipelines.map(async ({ id }) => {
60+
const pipeline = await this.callApi<PipelineObject>(
61+
`projects/${projectID}/pipelines/${id}`,
62+
{},
63+
) as PipelineObject;
64+
pipeline.project_name = (projectObj as any)?.name ;
65+
return pipeline;
66+
}));
67+
6068
return {
6169
getPipelinesData: pipelineObjects!,
6270
};

0 commit comments

Comments
 (0)