Skip to content

Commit 930a81c

Browse files
committed
chore(leaderboard): CR - 提示文案补 GH_PAT、catch 分支打印首次异常
Copilot CR #280: - 告警文案原来只提 GITHUB_TOKEN,可能误导本地只设 GH_PAT 的排查 - catch 分支之前只累加 failureCount,网络/DNS/SSL 异常无任何日志线索;补一次首次异常输出,与非 2xx 分支保持一致
1 parent bb7f532 commit 930a81c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

scripts/generate-leaderboard.mjs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async function main() {
188188
const ghToken = process.env.GITHUB_TOKEN || process.env.GH_PAT || "";
189189
if (!ghToken) {
190190
console.warn(
191-
"[generate-leaderboard] 未检测到 GITHUB_TOKEN,名字获取会因限流失败,榜单只会展示 id 占位符",
191+
"[generate-leaderboard] 未检测到 GITHUB_TOKEN/GH_PAT(GitHub token),名字获取会因限流失败,榜单只会展示 id 占位符",
192192
);
193193
}
194194

@@ -222,6 +222,13 @@ async function main() {
222222
}
223223
} catch (err) {
224224
failureCount++;
225+
// 首次网络/DNS/SSL 等异常打印一次错误消息,便于排查;后续静默计数
226+
if (failureCount === 1) {
227+
console.warn(
228+
"[generate-leaderboard] GitHub API 请求异常,后续失败将静默计数。示例错误:",
229+
err instanceof Error ? err.message : err,
230+
);
231+
}
225232
}
226233
}
227234
console.log(

0 commit comments

Comments
 (0)