From 28800103953901520f7a1559ddf086f9cc4e2ae3 Mon Sep 17 00:00:00 2001 From: enniel Date: Sun, 17 Oct 2021 14:22:45 +0300 Subject: [PATCH] working-directory input --- lib/index.js | 18 ++++++++++++++++++ src/index.ts | 19 +++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/lib/index.js b/lib/index.js index 1caf8ad..4d6ab94 100644 --- a/lib/index.js +++ b/lib/index.js @@ -5452,6 +5452,24 @@ function run() { if (process.platform !== "darwin" && process.platform !== "linux") { throw new Error("Unsupported virtual machine: please use either macos or ubuntu VM."); } + // custom working directory + const workingDirectoryInput = core.getInput("working-directory"); + if (workingDirectoryInput) { + console.log(`custom working directory: ${workingDirectoryInput}`); + } + const workingDirectory = !workingDirectoryInput + ? undefined + : workingDirectoryInput; + // execute the custom script + try { + // move to custom working directory if set + if (workingDirectory) { + process.chdir(workingDirectory); + } + } + catch (error) { + core.setFailed(error.message); + } const bundleToolPath = `${process.env.HOME}/bundletool`; const bundleToolFile = `${bundleToolPath}/bundletool.jar`; yield io.mkdirP(bundleToolPath); diff --git a/src/index.ts b/src/index.ts index 6569f62..038bfa5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,6 +15,25 @@ async function run() { ); } + // custom working directory + const workingDirectoryInput = core.getInput("working-directory"); + if (workingDirectoryInput) { + console.log(`custom working directory: ${workingDirectoryInput}`); + } + const workingDirectory = !workingDirectoryInput + ? undefined + : workingDirectoryInput; + + // execute the custom script + try { + // move to custom working directory if set + if (workingDirectory) { + process.chdir(workingDirectory); + } + } catch (error: any) { + core.setFailed(error.message); + } + const bundleToolPath = `${process.env.HOME}/bundletool`; const bundleToolFile = `${bundleToolPath}/bundletool.jar`;