🔧 chore(github-action.ts): add check for changes in commit messages before rebasing to improve efficiency (#222)

🐛 fix(github-action.ts): fix logic to check if there are any changes in commit messages before rebasing to ensure correct behavior
This commit is contained in:
Malthe Poulsen
2023-09-03 06:22:05 +02:00
committed by GitHub
parent 4e374aa9db
commit c1627bb98c
+10
View File
@@ -133,6 +133,16 @@ async function improveCommitMessages(
improvedMessagesWithSHAs
);
// Check if there are actually any changes in the commit messages
const messagesChanged = improvedMessagesWithSHAs.some(
({ sha, msg }, index) => msg !== commitsToImprove[index].message
);
if (!messagesChanged) {
console.log('No changes in commit messages detected, skipping rebase');
return;
}
const createCommitMessageFile = (message: string, index: number) =>
writeFileSync(`./commit-${index}.txt`, message);
improvedMessagesWithSHAs.forEach(({ msg }, i) =>