From bfeea4c2a9cf3f522205026f5a558d22169dd670 Mon Sep 17 00:00:00 2001 From: Jeffery Date: Sat, 11 Jul 2026 14:00:52 +0000 Subject: [PATCH] =?UTF-8?q?fix(cleanup-release):=20=E5=81=9C=E6=AD=A2?= =?UTF-8?q?=E5=A4=B1=E6=95=97=E5=BE=8C=E7=9A=84=20tag=20=E6=B8=85=E7=90=86?= =?UTF-8?q?=E4=B8=A6=E5=BF=AB=E5=8F=96=E6=99=82=E9=96=93=E6=88=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/index.js b/src/index.js index a833b02..5fad040 100644 --- a/src/index.js +++ b/src/index.js @@ -12,6 +12,8 @@ const taipeiFormatter = new Intl.DateTimeFormat('en-CA', { }); let currentStage = ''; +let cachedTimestampKey = ''; +let cachedTimestampValue = ''; /** * 格式化台灣時區時間,供 log 使用。 @@ -20,6 +22,11 @@ let currentStage = ''; * @returns {string} `yyyy/MM/dd HH:mm:ss` 格式時間字串。 */ function formatTaipeiTimestamp(date = new Date()) { + const timestampKey = date.toISOString().slice(0, 19); + if (timestampKey === cachedTimestampKey) { + return cachedTimestampValue; + } + const parts = taipeiFormatter.formatToParts(date); const lookup = {}; @@ -29,7 +36,9 @@ function formatTaipeiTimestamp(date = new Date()) { } } - return `${lookup.year}/${lookup.month}/${lookup.day} ${lookup.hour}:${lookup.minute}:${lookup.second}`; + cachedTimestampKey = timestampKey; + cachedTimestampValue = `${lookup.year}/${lookup.month}/${lookup.day} ${lookup.hour}:${lookup.minute}:${lookup.second}`; + return cachedTimestampValue; } /** @@ -348,6 +357,10 @@ async function main() { }); } + if (hadFailure) { + throw new Error('至少有一筆 release 或 tag 刪除失敗'); + } + section('刪除未指定 release 的 tag'); const releaseTags = new Set( @@ -388,9 +401,6 @@ async function main() { } }); - if (hadFailure) { - throw new Error('至少有一筆 release 或 tag 刪除失敗'); - } } main().catch((error) => {