From 00fe98e4e5794875053896043d674ea6513b8d0c Mon Sep 17 00:00:00 2001 From: James Ives Date: Wed, 25 Aug 2021 23:16:13 -0400 Subject: [PATCH] Single Commit Adjustments --- __tests__/git.test.ts | 6 +++--- __tests__/main.test.ts | 2 +- src/git.ts | 8 ++++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 1f04fa614..44da5e4dc 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -216,7 +216,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -240,7 +240,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(10) + expect(execute).toBeCalledTimes(11) expect(rmRF).toBeCalledTimes(1) }) @@ -265,7 +265,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateWorktree - expect(execute).toBeCalledTimes(10) + expect(execute).toBeCalledTimes(11) expect(rmRF).toBeCalledTimes(1) }) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 82dfee9e6..6ff9cbf66 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(13) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) }) diff --git a/src/git.ts b/src/git.ts index ed072abae..4d733aa47 100644 --- a/src/git.ts +++ b/src/git.ts @@ -143,6 +143,14 @@ export async function deploy(action: ActionInterface): Promise { action.silent ) + if (action.singleCommit) { + await execute( + `git add --all .`, + `${action.workspace}/${temporaryDeploymentDirectory}`, + action.silent + ) + } + // Use git status to check if we have something to commit. // Special case is singleCommit with existing history, when // we're really interested if the diff against the upstream branch