diff --git a/__tests__/git.test.ts b/__tests__/git.test.ts index 127efcba..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(11) + 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(17) + 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(11) + 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(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) }) @@ -421,7 +421,7 @@ describe('git', () => { await deploy(action) - expect(execute).toBeCalledTimes(11) + expect(execute).toBeCalledTimes(12) expect(rmRF).toBeCalledTimes(1) expect(mkdirP).toBeCalledTimes(1) }) @@ -439,7 +439,7 @@ describe('git', () => { }) const response = await deploy(action) - expect(execute).toBeCalledTimes(12) + expect(execute).toBeCalledTimes(13) expect(rmRF).toBeCalledTimes(1) expect(response).toBe(Status.SKIPPED) }) @@ -461,7 +461,7 @@ describe('git', () => { try { await deploy(action) } catch (e) { - expect(execute).toBeCalledTimes(0) + expect(execute).toBeCalledTimes(1) expect(rmRF).toBeCalledTimes(1) expect(e.message).toMatch( 'The deploy step encountered an error: No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true. ❌' diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 140ce144..4d7b1c87 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -47,7 +47,7 @@ describe('main', () => { debug: true }) await run(action) - expect(execute).toBeCalledTimes(18) + expect(execute).toBeCalledTimes(19) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) }) @@ -64,7 +64,7 @@ describe('main', () => { } }) await run(action) - expect(execute).toBeCalledTimes(17) + expect(execute).toBeCalledTimes(18) expect(rmRF).toBeCalledTimes(1) expect(exportVariable).toBeCalledTimes(1) }) diff --git a/package.json b/package.json index bfb2ad01..2abbda2b 100644 --- a/package.json +++ b/package.json @@ -39,16 +39,16 @@ "@actions/io": "1.0.2" }, "devDependencies": { - "@types/jest": "25.2.2", - "@types/node": "14.0.1", + "@types/jest": "25.2.3", + "@types/node": "14.0.5", "eslint": "7.0.0", "eslint-plugin-github": "3.4.1", - "eslint-plugin-jest": "23.11.0", + "eslint-plugin-jest": "23.13.1", "eslint-plugin-prettier": "^3.1.2", "jest": "25.5.4", "jest-circus": "26.0.1", "prettier": "2.0.5", "ts-jest": "25.5.1", - "typescript": "3.9.2" + "typescript": "3.9.3" } } diff --git a/src/git.ts b/src/git.ts index 347e1454..1a39ac69 100644 --- a/src/git.ts +++ b/src/git.ts @@ -246,6 +246,10 @@ export async function deploy(action: ActionInterface): Promise { ) } finally { // Ensures the deployment directory is safely removed after each deployment. + await execute( + `git worktree remove ${temporaryDeploymentDirectory}`, + action.workspace + ) await rmRF(temporaryDeploymentDirectory) } } diff --git a/yarn.lock b/yarn.lock index ded050b8..cb751706 100644 --- a/yarn.lock +++ b/yarn.lock @@ -734,9 +734,9 @@ "@types/istanbul-lib-coverage" "*" "@types/istanbul-lib-report" "*" -"@types/jest@25.2.2": - version "25.2.2" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.2.tgz#6a752e7a00f69c3e790ea00c345029d5cefa92bf" +"@types/jest@25.2.3": + version "25.2.3" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-25.2.3.tgz#33d27e4c4716caae4eced355097a47ad363fdcaf" dependencies: jest-diff "^25.2.1" pretty-format "^25.2.1" @@ -745,9 +745,9 @@ version "7.0.4" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.4.tgz#38fd73ddfd9b55abb1e1b2ed578cb55bd7b7d339" -"@types/node@*", "@types/node@14.0.1", "@types/node@>= 8": - version "14.0.1" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.1.tgz#5d93e0a099cd0acd5ef3d5bde3c086e1f49ff68c" +"@types/node@*", "@types/node@14.0.5", "@types/node@>= 8": + version "14.0.5" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.5.tgz#3d03acd3b3414cf67faf999aed11682ed121f22b" "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -1721,9 +1721,9 @@ eslint-plugin-import@>=2.18.2: read-pkg-up "^2.0.0" resolve "^1.12.0" -eslint-plugin-jest@23.11.0: - version "23.11.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.11.0.tgz#6e01d83ea74c1eefd60811655bbc288bd8ab2e7d" +eslint-plugin-jest@23.13.1: + version "23.13.1" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.13.1.tgz#b2ce83f76064ad8ba1f1f26f322b86a86e44148e" dependencies: "@typescript-eslint/experimental-utils" "^2.5.0" @@ -4775,9 +4775,9 @@ typedarray-to-buffer@^3.1.5: dependencies: is-typedarray "^1.0.0" -typescript@3.9.2: - version "3.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.2.tgz#64e9c8e9be6ea583c54607677dd4680a1cf35db9" +typescript@3.9.3: + version "3.9.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.3.tgz#d3ac8883a97c26139e42df5e93eeece33d610b8a" union-value@^1.0.0: version "1.0.1"