From c914d063fda550f08ded96b7f6946e4fb6081dc2 Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 27 Apr 2022 14:43:11 +0000 Subject: [PATCH] =?UTF-8?q?Deploy=20Production=20Code=20for=20Commit=20781?= =?UTF-8?q?d9e3cedb923cbb8be9b91dfae4a40c474a730=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/git.js | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/lib/git.js b/lib/git.js index 51b8edf1..a25c5287 100644 --- a/lib/git.js +++ b/lib/git.js @@ -26,31 +26,12 @@ function init(action) { try { (0, core_1.info)(`Deploying using ${action.tokenType}… 🔑`); (0, core_1.info)('Configuring git…'); - function configure(throwOnError) { - return __awaiter(this, void 0, void 0, function* () { - try { - yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}"`, action.workspace, action.silent); - yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent); - yield (0, execute_1.execute)(`git config user.email "${action.email}"`, action.workspace, action.silent); - yield (0, execute_1.execute)(`git config core.ignorecase false`, action.workspace, action.silent); - } - catch (_a) { - (0, core_1.info)('There was a problemissue initilizing git, attempting to resolve …'); - if (throwOnError) { - throw new Error(); - } - } - }); - } - try { - yield configure(false); - } - catch (_a) { - // Attempt to re-run if initial configuration failed using git init. - yield (0, execute_1.execute)(`git init`, action.workspace, action.silent); - yield (0, execute_1.execute)(`git commit -m "Initial commit" --allow-empty`, action.workspace, action.silent); - yield configure(true); - } + yield (0, execute_1.execute)(`git init`, action.workspace, action.silent); + yield (0, execute_1.execute)(`git commit -m "Initial commit" --allow-empty`, action.workspace, action.silent); + yield (0, execute_1.execute)(`git config --global --add safe.directory "${action.workspace}"`, action.workspace, action.silent); + yield (0, execute_1.execute)(`git config user.name "${action.name}"`, action.workspace, action.silent); + yield (0, execute_1.execute)(`git config user.email "${action.email}"`, action.workspace, action.silent); + yield (0, execute_1.execute)(`git config core.ignorecase false`, action.workspace, action.silent); try { if ((process.env.CI && !action.sshKey) || action.isTest) { /* Ensures that previously set Git configs do not interfere with the deployment. @@ -62,7 +43,7 @@ function init(action) { throw new Error(); } } - catch (_b) { + catch (_a) { (0, core_1.info)('Unable to unset previous git config authentication as it may not exist, continuing…'); } try { @@ -71,7 +52,7 @@ function init(action) { throw new Error(); } } - catch (_c) { + catch (_b) { (0, core_1.info)('Attempted to remove origin but failed, continuing…'); } yield (0, execute_1.execute)(`git remote add origin ${action.repositoryPath}`, action.workspace, action.silent);