fix(issue-update): 網址夾帶私有提醒時擋下,並修正 TDZ 錯誤
把上一次寫回的整行一起複製貼上是很常見的手誤,放行的話那句提醒會在議題上出現 兩次。 順帶修掉一個自己造出來的錯:PRIVACY_NOTE 原本宣告在 main() 之後,而新的檢查在 main() 的同步段就要用到它,於是每次執行都以「Cannot access 'PRIVACY_NOTE' before initialization」收場。常數移到 main() 之前。 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+10
-3
@@ -30,6 +30,9 @@ import {
|
||||
} from './lib.js';
|
||||
import { upsertLineInSection } from './issue-body.js';
|
||||
|
||||
/** artifact 預設私有,組織外開不起來——這件事要跟著連結一起留在議題上 */
|
||||
const PRIVACY_NOTE = '(此連結預設為私有,組織外無法開啟)';
|
||||
|
||||
main(async () => {
|
||||
const flags = parseFlags(process.argv.slice(2), {
|
||||
required: ['repo', 'index'],
|
||||
@@ -95,14 +98,18 @@ function parseDueDate(value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/** artifact 預設私有,組織外開不起來——這件事要跟著連結一起留在議題上 */
|
||||
const PRIVACY_NOTE = '(此連結預設為私有,組織外無法開啟)';
|
||||
|
||||
function parseOverviewUrl(value) {
|
||||
if (value === undefined) return null;
|
||||
if (!/^https?:\/\/\S+$/.test(value)) {
|
||||
throw new ScriptError('BAD_OVERVIEW_URL', `--overview-url 需為 http(s) 網址,收到的是 ${value}`);
|
||||
}
|
||||
// 連上一次寫回的整行一起複製貼上是很常見的手誤,放行的話那句提醒會在議題上出現兩次
|
||||
if (value.includes(PRIVACY_NOTE)) {
|
||||
throw new ScriptError(
|
||||
'BAD_OVERVIEW_URL',
|
||||
`--overview-url 夾帶了上一次寫回的提醒文字,請只給網址本身:${value}`,
|
||||
);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user