From c1627bb98cb87f20c50ca816a44005ce6d06383f Mon Sep 17 00:00:00 2001 From: Malthe Poulsen <30603252+malpou@users.noreply.github.com> Date: Sun, 3 Sep 2023 06:22:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20chore(github-action.ts):=20add?= =?UTF-8?q?=20check=20for=20changes=20in=20commit=20messages=20before=20re?= =?UTF-8?q?basing=20to=20improve=20efficiency=20(#222)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🐛 fix(github-action.ts): fix logic to check if there are any changes in commit messages before rebasing to ensure correct behavior --- src/github-action.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/github-action.ts b/src/github-action.ts index cb12577..b92b342 100644 --- a/src/github-action.ts +++ b/src/github-action.ts @@ -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) =>