From f107bd5c8c6525a089abda5d027de046f8e68b09 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Wed, 28 Jan 2026 12:11:53 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Patrik Oldsberg --- scripts/patch-release-for-pr.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/patch-release-for-pr.js b/scripts/patch-release-for-pr.js index 7a407b760b..71d9eac091 100755 --- a/scripts/patch-release-for-pr.js +++ b/scripts/patch-release-for-pr.js @@ -278,13 +278,16 @@ async function main(args) { const commitMessage = `Patch from PR #${prNumber}`; + const commitMessagePattern = `^${commitMessage}$`; + // Check if this patch has already been applied by looking for the commit message try { const existingCommit = await run( 'git', 'log', + '--extended-regexp', '--grep', - commitMessage, + commitMessagePattern, '--format=%H', '-1', ); @@ -300,7 +303,8 @@ async function main(args) { } let hasChanges = false; - for (const logSha of logLines.split(/\r?\n/)) { + const commitShas = logLines.split(/\r?\n/).filter(Boolean); + for (const logSha of commitShas) { try { await run('git', 'cherry-pick', '-n', logSha); hasChanges = true;