mirror of
https://github.com/changesets/action
synced 2026-10-26 16:39:56 +08:00
Fixed an issue with the action crashing on commit attempts in projects with commit: true (#61)
This commit is contained in:
@@ -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
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user