From 96c9a039d6e784ba7886176dedc54aa70c62e94d Mon Sep 17 00:00:00 2001 From: iTrooz_ Date: Sun, 19 Jun 2022 00:28:07 +0200 Subject: [PATCH] write zip file in path --- main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main.js b/main.js index af24923d..fa5949cc 100644 --- a/main.js +++ b/main.js @@ -190,26 +190,26 @@ async function main() { archive_format: "zip", }) + const basePath = name ? path : pathname.join(path, artifact.name) if (skipUnpack) { - fs.writeFileSync(`${artifact.name}.zip`, Buffer.from(zip.data), 'binary') + fs.writeFileSync(`${basePath}.zip`, Buffer.from(zip.data), 'binary') continue } - const dir = name ? path : pathname.join(path, artifact.name) - fs.mkdirSync(dir, { recursive: true }) + fs.mkdirSync(basePath, { recursive: true }) const adm = new AdmZip(Buffer.from(zip.data)) core.startGroup(`==> Extracting: ${artifact.name}.zip`) adm.getEntries().forEach((entry) => { const action = entry.isDirectory ? "creating" : "inflating" - const filepath = pathname.join(dir, entry.entryName) + const filepath = pathname.join(basePath, entry.entryName) core.info(` ${action}: ${filepath}`) }) - adm.extractAllTo(dir, true) + adm.extractAllTo(basePath, true) core.endGroup() } } catch (error) {