Fixed an issue with the action crashing on commit attempts in projects with commit: true (#61)

This commit is contained in:
Mateusz Burzyński
2020-11-30 08:10:04 +01:00
committed by GitHub
parent bfeb9e077e
commit 6c6b3b9bb0
3 changed files with 15 additions and 6 deletions
+2 -2
View File
File diff suppressed because one or more lines are too long
+5
View File
@@ -59,3 +59,8 @@ export const commitAll = async (message: string) => {
await exec("git", ["add", "."]);
await exec("git", ["commit", "-m", message]);
};
export const checkIfClean = async (): Promise<boolean> => {
const { stdout } = await execWithOutput("git", ["status", "--porcelain"]);
return !stdout.length;
};
+8 -4
View File
@@ -250,11 +250,15 @@ ${
})();
const finalPrTitle = `${prTitle}${!!preState ? ` (${preState.tag})` : ""}`;
const finalCommitMessage = `${commitMessage}${
!!preState ? ` (${preState.tag})` : ""
}`;
await gitUtils.commitAll(finalCommitMessage);
// project with `commit: true` setting could have already committed files
if (!(await gitUtils.checkIfClean())) {
const finalCommitMessage = `${commitMessage}${
!!preState ? ` (${preState.tag})` : ""
}`;
await gitUtils.commitAll(finalCommitMessage);
}
await gitUtils.push(versionBranch, { force: true });
let searchResult = await searchResultPromise;