cleanup-release 動作重整與安全強化 #2
+14
-4
@@ -12,6 +12,8 @@ const taipeiFormatter = new Intl.DateTimeFormat('en-CA', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let currentStage = '';
|
let currentStage = '';
|
||||||
|
let cachedTimestampKey = '';
|
||||||
|
let cachedTimestampValue = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 格式化台灣時區時間,供 log 使用。
|
* 格式化台灣時區時間,供 log 使用。
|
||||||
@@ -20,6 +22,11 @@ let currentStage = '';
|
|||||||
* @returns {string} `yyyy/MM/dd HH:mm:ss` 格式時間字串。
|
* @returns {string} `yyyy/MM/dd HH:mm:ss` 格式時間字串。
|
||||||
*/
|
*/
|
||||||
function formatTaipeiTimestamp(date = new Date()) {
|
function formatTaipeiTimestamp(date = new Date()) {
|
||||||
|
const timestampKey = date.toISOString().slice(0, 19);
|
||||||
|
if (timestampKey === cachedTimestampKey) {
|
||||||
|
return cachedTimestampValue;
|
||||||
|
}
|
||||||
|
|
||||||
const parts = taipeiFormatter.formatToParts(date);
|
const parts = taipeiFormatter.formatToParts(date);
|
||||||
|
|
||||||
const lookup = {};
|
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');
|
section('刪除未指定 release 的 tag');
|
||||||
|
|
||||||
const releaseTags = new Set(
|
const releaseTags = new Set(
|
||||||
@@ -388,9 +401,6 @@ async function main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hadFailure) {
|
|
||||||
throw new Error('至少有一筆 release 或 tag 刪除失敗');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user