From 93b4fb714775253e1a8a32e92ab6e5ed0888ba47 Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 17 Nov 2021 09:04:50 -0500 Subject: [PATCH 1/2] Unit Tests --- __tests__/git.test.ts | 20 ++++++++++---------- __tests__/main.test.ts | 2 +- src/git.ts | 6 ++++++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 69e9bfac5..469556cbf 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -168,7 +168,7 @@ describe('git', () => { const response = await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(12) + expect(execute).toBeCalledTimes(13) expect(rmRF).toBeCalledTimes(1) expect(response).toBe(Status.SUCCESS) }) @@ -191,7 +191,7 @@ describe('git', () => { const response = await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) expect(response).toBe(Status.SUCCESS) }) @@ -216,7 +216,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(12) + expect(execute).toBeCalledTimes(13) expect(rmRF).toBeCalledTimes(1) }) @@ -240,7 +240,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -265,7 +265,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -296,7 +296,7 @@ describe('git', () => { const response = await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(12) + expect(execute).toBeCalledTimes(13) expect(rmRF).toBeCalledTimes(1) expect(fs.existsSync).toBeCalledTimes(2) expect(response).toBe(Status.SUCCESS) @@ -328,7 +328,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(9) + expect(execute).toBeCalledTimes(10) expect(rmRF).toBeCalledTimes(1) }) }) @@ -353,7 +353,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(9) + expect(execute).toBeCalledTimes(10) expect(rmRF).toBeCalledTimes(1) }) @@ -373,7 +373,7 @@ describe('git', () => { await deploy(action) - expect(execute).toBeCalledTimes(9) + expect(execute).toBeCalledTimes(10) expect(rmRF).toBeCalledTimes(1) expect(mkdirP).toBeCalledTimes(1) }) @@ -393,7 +393,7 @@ describe('git', () => { }) const response = await deploy(action) - expect(execute).toBeCalledTimes(9) + expect(execute).toBeCalledTimes(10) expect(rmRF).toBeCalledTimes(1) expect(response).toBe(Status.SKIPPED) }) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 82dfee9e6..eac862259 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -69,7 +69,7 @@ describe('main', () => { isTest: TestFlag.HAS_CHANGED_FILES }) await run(action) - expect(execute).toBeCalledTimes(17) + expect(execute).toBeCalledTimes(18) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) }) diff --git a/src/git.ts b/src/git.ts index c91d3c296..291511b20 100644 --- a/src/git.ts +++ b/src/git.ts @@ -226,6 +226,12 @@ export async function deploy(action: ActionInterface): Promise { action.silent ) + await execute( + `chmod -R 777 ${temporaryDeploymentDirectory}`, + action.workspace, + action.silent + ) + await execute( `git worktree remove ${temporaryDeploymentDirectory} --force`, action.workspace, From 8e3a3e7db99a45ac11fb1d7e5a25a1abad4f697f Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 17 Nov 2021 09:26:48 -0500 Subject: [PATCH 2/2] Update main.test.ts --- __tests__/main.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index eac862259..510e7c65e 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -49,7 +49,7 @@ describe('main', () => { debug: true }) await run(action) - expect(execute).toBeCalledTimes(14) + expect(execute).toBeCalledTimes(15) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) })