fix: normalize dev-status.json and collaborators.json field names for zhuyuan issue reply

The script expected field names (team_status, modules, next_step, waiting_for,
last_synced) that didn't match the actual Notion-synced data (team, module,
current, waiting, last_sync). Added a data normalization step after reading
JSON files to bridge the gap. Also handles nested collaborators.json format
and missing tech_routing/server_info/os fields gracefully.

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-11 13:04:08 +00:00
parent f62687d5da
commit 054900ba4f
1 changed files with 35 additions and 0 deletions

View File

@ -24,6 +24,41 @@ try {
collaborators = [];
}
// === 数据规范化:兼容 Notion 同步的字段名差异 ===
if (devStatus.team && !devStatus.team_status) {
devStatus.team_status = devStatus.team;
}
if (devStatus.last_sync && !devStatus.last_synced) {
devStatus.last_synced = devStatus.last_sync;
}
if (!devStatus.tech_routing) {
devStatus.tech_routing = { level_2_peer_help: {} };
}
if (!devStatus.server_info) {
devStatus.server_info = {};
}
if (Array.isArray(devStatus.team_status)) {
devStatus.team_status.forEach(dev => {
if (dev.module !== undefined && dev.modules === undefined) {
dev.modules = [dev.module];
}
if (dev.current !== undefined && dev.next_step === undefined) {
dev.next_step = dev.current;
}
if (dev.waiting !== undefined && dev.waiting_for === undefined) {
dev.waiting_for = dev.waiting;
}
if (!dev.os) {
dev.os = '未记录';
}
});
}
// 兼容 collaborators.json 的嵌套结构
if (!Array.isArray(collaborators) && collaborators && collaborators.collaborators) {
collaborators = collaborators.collaborators;
}
const issueNumber = process.env.ISSUE_NUMBER;
const issueTitle = process.env.ISSUE_TITLE || '';
const issueBody = process.env.ISSUE_BODY || '';