From 5cfaab981ebd933f69855f8b49fe8b4e76e6633b Mon Sep 17 00:00:00 2001 From: James Ives Date: Sun, 24 May 2020 12:38:27 -0400 Subject: [PATCH] Fixes an issue preventing deployments --- __tests__/git.test.ts | 10 +++++----- __tests__/main.test.ts | 2 +- src/constants.ts | 5 +++-- src/git.ts | 5 ----- src/util.ts | 7 +++---- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index e72f1863..6063853f 100644 --- a/__tests__/git.test.ts +++ b/__tests__/git.test.ts @@ -341,7 +341,7 @@ describe('git', () => { const response = await deploy(action) // Includes the call to generateBranch - expect(execute).toBeCalledTimes(13) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) expect(response).toBe(Status.SUCCESS) }) @@ -361,7 +361,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateBranch - expect(execute).toBeCalledTimes(19) + expect(execute).toBeCalledTimes(18) expect(rmRF).toBeCalledTimes(1) }) @@ -382,7 +382,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateBranch - expect(execute).toBeCalledTimes(13) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -402,7 +402,7 @@ describe('git', () => { await deploy(action) // Includes the call to generateBranch - expect(execute).toBeCalledTimes(13) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -421,7 +421,7 @@ describe('git', () => { await deploy(action) - expect(execute).toBeCalledTimes(13) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) expect(mkdirP).toBeCalledTimes(1) }) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index c608ffa0..4d7b1c87 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -64,7 +64,7 @@ describe('main', () => { } }) await run(action) - expect(execute).toBeCalledTimes(19) + expect(execute).toBeCalledTimes(18) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) }) diff --git a/src/constants.ts b/src/constants.ts index 00614be5..a2a89ac8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -67,8 +67,9 @@ export const action: ActionInterface = { ? getInput('GIT_CONFIG_EMAIL') : pusher && pusher.email ? pusher.email - : `${process.env.GITHUB_ACTOR || - 'github-pages-deploy-action'}@users.noreply.github.com`, + : `${ + process.env.GITHUB_ACTOR || 'github-pages-deploy-action' + }@users.noreply.github.com`, gitHubToken: getInput('GITHUB_TOKEN'), name: !isNullOrUndefined(getInput('GIT_CONFIG_NAME')) ? getInput('GIT_CONFIG_NAME') diff --git a/src/git.ts b/src/git.ts index c9daaf90..663edb13 100644 --- a/src/git.ts +++ b/src/git.ts @@ -233,11 +233,6 @@ export async function deploy(action: ActionInterface): Promise { action.workspace ) - await execute( - `git branch -D ${temporaryDeploymentBranch}`, - action.workspace - ) - return Status.SUCCESS } catch (error) { throw new Error( diff --git a/src/util.ts b/src/util.ts index 75454c21..735f6f5a 100644 --- a/src/util.ts +++ b/src/util.ts @@ -19,10 +19,9 @@ export const generateTokenType = (action: ActionInterface): string => export const generateRepositoryPath = (action: ActionInterface): string => action.ssh ? `git@github.com:${action.repositoryName}` - : `https://${action.accessToken || - `x-access-token:${action.gitHubToken}`}@github.com/${ - action.repositoryName - }.git` + : `https://${ + action.accessToken || `x-access-token:${action.gitHubToken}` + }@github.com/${action.repositoryName}.git` /* Checks for the required tokens and formatting. Throws an error if any case is matched. */ export const hasRequiredParameters = (action: ActionInterface): void => {