From b22f2e67d3caa659974348de97e390d55fc81476 Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 27 Apr 2022 06:44:37 -0400 Subject: [PATCH] Update git.ts --- src/git.ts | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/git.ts b/src/git.ts index cab1061b..9ea6aa04 100644 --- a/src/git.ts +++ b/src/git.ts @@ -31,15 +31,12 @@ export async function init(action: ActionInterface): Promise { attempt++ if (attempt > ATTEMPT_LIMIT) { - throw new Error(); + throw new Error() } if (attempt > 1) { - await execute( - `git init`, - action.workspace, - action.silent - ) + // Handles the 'fatal: not a git directory' error. + await execute(`git init`, action.workspace, action.silent) await execute( `git commit -m "Initial commit" --allow-empty`, @@ -59,20 +56,20 @@ export async function init(action: ActionInterface): Promise { action.workspace, action.silent ) - + await execute( `git config user.email "${action.email}"`, action.workspace, action.silent ) - + await execute( `git config core.ignorecase false`, action.workspace, action.silent ) - } while(rejected) - + } while (rejected) + try { if ((process.env.CI && !action.sshKey) || action.isTest) { /* Ensures that previously set Git configs do not interfere with the deployment.