chore: triage log output suggestions
This commit is contained in:
@@ -329,5 +329,15 @@
|
|||||||
"role": "Leo",
|
"role": "Leo",
|
||||||
"location": "action.yaml:80",
|
"location": "action.yaml:80",
|
||||||
"suggestion": "在 `runs.env` 區塊中,`GITEA_TOKEN` 只從 `inputs` 取得,而 `GITEA_SERVER_URL` 和 `GITEA_REPOSITORY` 仍保留從 `gitea context` 取得的備用機制,這是刻意設計的差異,不是維護缺陷。"
|
"suggestion": "在 `runs.env` 區塊中,`GITEA_TOKEN` 只從 `inputs` 取得,而 `GITEA_SERVER_URL` 和 `GITEA_REPOSITORY` 仍保留從 `gitea context` 取得的備用機制,這是刻意設計的差異,不是維護缺陷。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Rex",
|
||||||
|
"location": "action.yaml:18",
|
||||||
|
"suggestion": "引入 `GITEA_COMMENT_TOKEN` 是一個很好的實踐,遵循最小權限原則。請確保為此 token 配置的權限確實僅限於發布評論。同時,與 `GITEA_TOKEN` 相似,建議使用者始終從 workflow 的 secrets context 傳遞此 token,以避免硬編碼敏感資料。"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "Leo",
|
||||||
|
"location": "app/log.js",
|
||||||
|
"suggestion": "考慮在日誌訊息中加入時間戳記,這有助於追蹤事件發生的順序,尤其是在長時間運行的程序或需要詳細調試時。可以在每個日誌函式內部自動添加時間戳記。"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+5
-1
@@ -185,12 +185,16 @@ describe('commitAndPush', () => {
|
|||||||
});
|
});
|
||||||
const logs = [];
|
const logs = [];
|
||||||
const originalLog = console.log;
|
const originalLog = console.log;
|
||||||
console.log = (...args) => { logs.push(args.join(' ')); };
|
const originalWarn = console.warn;
|
||||||
|
const capture = (...args) => { logs.push(args.join(' ')); };
|
||||||
|
console.log = capture;
|
||||||
|
console.warn = capture;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await commitAndPush(workspace, repoDir, spawn, sourceRoot);
|
await commitAndPush(workspace, repoDir, spawn, sourceRoot);
|
||||||
} finally {
|
} finally {
|
||||||
console.log = originalLog;
|
console.log = originalLog;
|
||||||
|
console.warn = originalWarn;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.ok(logs.some(line => line.includes('Step7 commit 成功但 push 失敗')));
|
assert.ok(logs.some(line => line.includes('Step7 commit 成功但 push 失敗')));
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ export function ok(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function warn(message) {
|
export function warn(message) {
|
||||||
console.log(` ! ${message}`);
|
console.warn(` ! ${message}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function error(message) {
|
export function error(message) {
|
||||||
|
|||||||
Reference in New Issue
Block a user