From 6403497821f515a84572cab6e0f3513c565a45db Mon Sep 17 00:00:00 2001 From: Sanjaiyan Parthipan Date: Sat, 7 Oct 2023 23:15:48 +0530 Subject: [PATCH] concurrent function async --- src/lib/host/ActionsHost.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/host/ActionsHost.ts b/src/lib/host/ActionsHost.ts index 9bb43df10..c11fd1ac9 100644 --- a/src/lib/host/ActionsHost.ts +++ b/src/lib/host/ActionsHost.ts @@ -46,15 +46,15 @@ class ActionsArtifactStore implements IArtifactStore { public async upload(artifactName: string, files: string[]): Promise { ActionsLogger.debug(`files: ${files.join(';')}`); await fs.emptyDir(this._resultsDirectory); - for (const file of files) { + await Promise.all(files.map((file) => { if (path.extname(file).toLowerCase() === '.zip') { ActionsLogger.debug(`unzipping ${file} into ${this._resultsDirectory} ...`); - await extractToFolder(file, this._resultsDirectory); + return extractToFolder(file, this._resultsDirectory); } else { ActionsLogger.debug(`copying ${file} into ${this._resultsDirectory} ...`); - await fs.copyFile(file, path.join(this._resultsDirectory, path.basename(file))); + return fs.copyFile(file, path.join(this._resultsDirectory, path.basename(file))); } - } + })); const client = artifact.create(); // pipeline has no artifact store (e.g. release pipelines):