Skips deployment if the working tree is clean (#55)

* Adding procelain

* Update git.ts
This commit is contained in:
James Ives 2019-11-19 18:07:27 -05:00 committed by GitHub
parent 7a65168f11
commit 0dfa1cb46b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -102,6 +102,11 @@ function deploy() {
force: true 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. // Commits to GitHub.
yield util_1.execute(`git add --all .`, temporaryDeploymentDirectory); yield util_1.execute(`git add --all .`, temporaryDeploymentDirectory);
yield util_1.execute(`git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory); yield util_1.execute(`git switch -c ${temporaryDeploymentBranch}`, temporaryDeploymentDirectory);

View File

@ -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. // Commits to GitHub.
await execute(`git add --all .`, temporaryDeploymentDirectory); await execute(`git add --all .`, temporaryDeploymentDirectory);
await execute( await execute(