Skip to content

Commit 6c2a931

Browse files
authored
Removes the call to -D (#713)
* Removes the call to -D * Update main.test.ts
1 parent fa74174 commit 6c2a931

File tree

3 files changed

+17
-26
lines changed

3 files changed

+17
-26
lines changed

__tests__/git.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('git', () => {
168168
const response = await deploy(action)
169169

170170
// Includes the call to generateWorktree
171-
expect(execute).toBeCalledTimes(13)
171+
expect(execute).toBeCalledTimes(12)
172172
expect(rmRF).toBeCalledTimes(1)
173173
expect(response).toBe(Status.SUCCESS)
174174
})
@@ -191,7 +191,7 @@ describe('git', () => {
191191
const response = await deploy(action)
192192

193193
// Includes the call to generateWorktree
194-
expect(execute).toBeCalledTimes(12)
194+
expect(execute).toBeCalledTimes(11)
195195
expect(rmRF).toBeCalledTimes(1)
196196
expect(response).toBe(Status.SUCCESS)
197197
})
@@ -216,7 +216,7 @@ describe('git', () => {
216216
await deploy(action)
217217

218218
// Includes the call to generateWorktree
219-
expect(execute).toBeCalledTimes(10)
219+
expect(execute).toBeCalledTimes(11)
220220
expect(rmRF).toBeCalledTimes(1)
221221
})
222222

@@ -240,7 +240,7 @@ describe('git', () => {
240240
await deploy(action)
241241

242242
// Includes the call to generateWorktree
243-
expect(execute).toBeCalledTimes(9)
243+
expect(execute).toBeCalledTimes(10)
244244
expect(rmRF).toBeCalledTimes(1)
245245
})
246246

@@ -265,7 +265,7 @@ describe('git', () => {
265265
await deploy(action)
266266

267267
// Includes the call to generateWorktree
268-
expect(execute).toBeCalledTimes(9)
268+
expect(execute).toBeCalledTimes(10)
269269
expect(rmRF).toBeCalledTimes(1)
270270
})
271271

@@ -296,7 +296,7 @@ describe('git', () => {
296296
const response = await deploy(action)
297297

298298
// Includes the call to generateWorktree
299-
expect(execute).toBeCalledTimes(13)
299+
expect(execute).toBeCalledTimes(12)
300300
expect(rmRF).toBeCalledTimes(1)
301301
expect(fs.existsSync).toBeCalledTimes(2)
302302
expect(response).toBe(Status.SUCCESS)
@@ -328,7 +328,7 @@ describe('git', () => {
328328
await deploy(action)
329329

330330
// Includes the call to generateWorktree
331-
expect(execute).toBeCalledTimes(10)
331+
expect(execute).toBeCalledTimes(9)
332332
expect(rmRF).toBeCalledTimes(1)
333333
})
334334
})
@@ -353,7 +353,7 @@ describe('git', () => {
353353
await deploy(action)
354354

355355
// Includes the call to generateWorktree
356-
expect(execute).toBeCalledTimes(10)
356+
expect(execute).toBeCalledTimes(9)
357357
expect(rmRF).toBeCalledTimes(1)
358358
})
359359

@@ -373,7 +373,7 @@ describe('git', () => {
373373

374374
await deploy(action)
375375

376-
expect(execute).toBeCalledTimes(10)
376+
expect(execute).toBeCalledTimes(9)
377377
expect(rmRF).toBeCalledTimes(1)
378378
expect(mkdirP).toBeCalledTimes(1)
379379
})
@@ -393,7 +393,7 @@ describe('git', () => {
393393
})
394394

395395
const response = await deploy(action)
396-
expect(execute).toBeCalledTimes(10)
396+
expect(execute).toBeCalledTimes(9)
397397
expect(rmRF).toBeCalledTimes(1)
398398
expect(response).toBe(Status.SKIPPED)
399399
})

__tests__/main.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('main', () => {
4949
debug: true
5050
})
5151
await run(action)
52-
expect(execute).toBeCalledTimes(15)
52+
expect(execute).toBeCalledTimes(14)
5353
expect(rmRF).toBeCalledTimes(1)
5454
expect(exportVariable).toBeCalledTimes(1)
5555
})
@@ -69,7 +69,7 @@ describe('main', () => {
6969
isTest: TestFlag.HAS_CHANGED_FILES
7070
})
7171
await run(action)
72-
expect(execute).toBeCalledTimes(18)
72+
expect(execute).toBeCalledTimes(17)
7373
expect(rmRF).toBeCalledTimes(1)
7474
expect(exportVariable).toBeCalledTimes(1)
7575
})

src/git.ts

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,20 +208,11 @@ export async function deploy(action: ActionInterface): Promise<Status> {
208208
// Cleans up temporary files/folders and restores the git state.
209209
info('Running post deployment cleanup jobs… 🗑️')
210210

211-
if (!action.singleCommit) {
212-
info(`Resetting branch and removing artifacts…`)
213-
await execute(
214-
`git checkout -B ${temporaryDeploymentBranch}`,
215-
`${action.workspace}/${temporaryDeploymentDirectory}`,
216-
action.silent
217-
)
218-
219-
await execute(
220-
`git branch -D ${action.branch} --force`,
221-
action.workspace,
222-
action.silent
223-
)
224-
}
211+
await execute(
212+
`git checkout -B ${temporaryDeploymentBranch}`,
213+
`${action.workspace}/${temporaryDeploymentDirectory}`,
214+
action.silent
215+
)
225216

226217
await execute(
227218
`git worktree remove ${temporaryDeploymentDirectory} --force`,

0 commit comments

Comments
 (0)