Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions __tests__/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ describe('git', () => {
await deploy(action)

// Includes the call to generateWorktree
expect(execute).toHaveBeenCalledTimes(12)
expect(execute).toHaveBeenCalledTimes(13)
expect(rmRF).toHaveBeenCalledTimes(1)
})
})
Expand All @@ -352,7 +352,7 @@ describe('git', () => {
await deploy(action)

// Includes the call to generateWorktree
expect(execute).toHaveBeenCalledTimes(12)
expect(execute).toHaveBeenCalledTimes(13)
expect(rmRF).toHaveBeenCalledTimes(1)
})

Expand All @@ -372,7 +372,7 @@ describe('git', () => {

await deploy(action)

expect(execute).toHaveBeenCalledTimes(12)
expect(execute).toHaveBeenCalledTimes(13)
expect(rmRF).toHaveBeenCalledTimes(1)
expect(mkdirP).toHaveBeenCalledTimes(1)
})
Expand All @@ -392,7 +392,7 @@ describe('git', () => {
})

const response = await deploy(action)
expect(execute).toHaveBeenCalledTimes(12)
expect(execute).toHaveBeenCalledTimes(13)
expect(rmRF).toHaveBeenCalledTimes(1)
expect(response).toBe(Status.SKIPPED)
})
Expand Down
2 changes: 1 addition & 1 deletion __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('main', () => {
debug: true
})
await run(action)
expect(execute).toHaveBeenCalledTimes(19)
expect(execute).toHaveBeenCalledTimes(20)
expect(rmRF).toHaveBeenCalledTimes(1)
expect(exportVariable).toHaveBeenCalledTimes(1)
})
Expand Down
13 changes: 7 additions & 6 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,13 @@ export async function deploy(action: ActionInterface): Promise<Status> {
? `git diff origin/${action.branch}`
: `git status --porcelain`

// Commits to GitHub.
await execute(
`git add --all .`,
`${action.workspace}/${temporaryDeploymentDirectory}`,
action.silent
)

info(`Checking if there are files to commit…`)

const hasFilesToCommit =
Expand All @@ -239,12 +246,6 @@ export async function deploy(action: ActionInterface): Promise<Status> {
return Status.SKIPPED
}

// Commits to GitHub.
await execute(
`git add --all .`,
`${action.workspace}/${temporaryDeploymentDirectory}`,
action.silent
)
await execute(
`git checkout -b ${temporaryDeploymentBranch}`,
`${action.workspace}/${temporaryDeploymentDirectory}`,
Expand Down