diff --git a/lib/git.js b/lib/git.js index f3d5f56b..162f333f 100644 --- a/lib/git.js +++ b/lib/git.js @@ -102,6 +102,11 @@ function deploy() { force: true }); } + const hasFilesToCommit = yield util_1.execute(`git status --porcelain`, temporaryDeploymentDirectory); + if (!hasFilesToCommit) { + console.log('There is nothing to commit. Exiting...'); + return Promise.resolve(); + } // Commits to GitHub. yield util_1.execute(`git add --all .`, temporaryDeploymentDirectory); yield util_1.execute(`git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory); diff --git a/src/git.ts b/src/git.ts index f7001575..66e1f79d 100644 --- a/src/git.ts +++ b/src/git.ts @@ -99,6 +99,16 @@ export async function deploy(): Promise { }); } + const hasFilesToCommit = await execute( + `git status --porcelain`, + temporaryDeploymentDirectory + ); + + if (!hasFilesToCommit) { + console.log("There is nothing to commit. Exiting..."); + return Promise.resolve(); + } + // Commits to GitHub. await execute(`git add --all .`, temporaryDeploymentDirectory); await execute(