From 69238e09f82b541d3653b0fd1061c9ac302fdcaa Mon Sep 17 00:00:00 2001 From: James Ives Date: Sat, 18 May 2024 02:01:58 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20Production=20Code=20for=20Commit=204dd?= =?UTF-8?q?89e159b367f61b8861b8ca4f64fdcabfe86e7=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/execute.d.ts | 1 - lib/execute.js | 13 +++---------- lib/worktree.js | 7 +------ 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/lib/execute.d.ts b/lib/execute.d.ts index adf2c1f385..c60948013d 100644 --- a/lib/execute.d.ts +++ b/lib/execute.d.ts @@ -2,7 +2,6 @@ type ExecuteOutput = { stdout: string; stderr: string; - exitCode: number; }; /** Wrapper around the GitHub toolkit exec command which returns the output. * Also allows you to easily toggle the current working directory. diff --git a/lib/execute.js b/lib/execute.js index 3fb82cbfe1..2e0ff4c529 100644 --- a/lib/execute.js +++ b/lib/execute.js @@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.stderr = exports.stdout = exports.execute = void 0; const exec_1 = require("@actions/exec"); const buffer_1 = __importDefault(require("buffer")); -const output = { stdout: '', stderr: '', exitCode: 0 }; +const output = { stdout: '', stderr: '' }; /** Wrapper around the GitHub toolkit exec command which returns the output. * Also allows you to easily toggle the current working directory. * @@ -29,18 +29,11 @@ function execute(cmd_1, cwd_1, silent_1) { return __awaiter(this, arguments, void 0, function* (cmd, cwd, silent, ignoreReturnCode = false) { output.stdout = ''; output.stderr = ''; - output.exitCode = yield (0, exec_1.exec)(cmd, [], { + yield (0, exec_1.exec)(cmd, [], { // Silences the input unless the INPUT_DEBUG flag is set. silent, cwd, - listeners: { - stdout: (data) => { - stdout(data); - }, - stderr: (data) => { - stderr(data); - } - }, + listeners: { stdout, stderr }, ignoreReturnCode }); return Promise.resolve(output); diff --git a/lib/worktree.js b/lib/worktree.js index dffa425ed1..0c2bbafbb1 100644 --- a/lib/worktree.js +++ b/lib/worktree.js @@ -40,12 +40,7 @@ function generateWorktree(action, worktreedir, branchExists) { if (branchExists) { yield (0, execute_1.execute)(`git fetch --no-recurse-submodules --depth=1 origin ${action.branch}`, action.workspace, action.silent); } - // Check if the worktree already exists - const { exitCode } = yield (0, execute_1.execute)(`git worktree list | grep ${worktreedir}`, action.workspace, action.silent); - // If the worktree exists, remove it - if (exitCode === 0) { - yield (0, execute_1.execute)(`git worktree remove ${worktreedir}`, action.workspace, action.silent); - } + yield (0, execute_1.execute)(`git worktree remove ${worktreedir}`, action.workspace, action.silent); yield (0, execute_1.execute)(`git worktree add --no-checkout --detach ${worktreedir}`, action.workspace, action.silent); const checkout = new GitCheckout(action.branch); if (branchExists) {