Skip to content

Commit

Permalink
Skips deployment if the working tree is clean (#55)
Browse files Browse the repository at this point in the history
* Adding procelain

* Update git.ts
  • Loading branch information
JamesIves authored Nov 19, 2019
1 parent 7a65168 commit 0dfa1cb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ export async function deploy(): Promise<any> {
});
}

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(
Expand Down

0 comments on commit 0dfa1cb

Please sign in to comment.