Skip to content

Commit f5ee423

Browse files
author
nevstop
committed
fix: --classify-only 不应需要 CSM_QA_GH_TOKEN
token 验证从 main() 开头移到 classify-only 之后, classify 步骤只做 LLM/正则分类,不需要 GitHub API token。 token 在 JOIN/QA/OTHER 分支各自获取,QA 步骤已配置。
1 parent f0fa80e commit f5ee423

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

scripts/router.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -759,17 +759,14 @@ def main(argv: Optional[list[str]] = None) -> int:
759759
_configure_logging()
760760
args = parse_args(argv)
761761

762-
token = os.environ.get("CSM_QA_GH_TOKEN", "")
763-
if not token:
764-
logger.error("CSM_QA_GH_TOKEN 未配置")
765-
return 1
766-
767762
logger.info(
768-
"Router 启动: discussion=%d author=%s category=%s dry_run=%s",
763+
"Router 启动: discussion=%d author=%s category=%s dry_run=%s classify_only=%s intent=%s",
769764
args.discussion_number,
770765
args.comment_author,
771766
args.category_name,
772767
args.dry_run,
768+
args.classify_only,
769+
args.intent,
773770
)
774771

775772
# ── 解析意图 ─────────────────────────────────────────────────────────
@@ -806,11 +803,18 @@ def main(argv: Optional[list[str]] = None) -> int:
806803
logger.info("空内容 + 非 Q&A + discussion.created → 跳过(不回复)")
807804
return 0
808805

809-
# 3. --classify-only:仅输出意图供 workflow 捕获
806+
# 3. --classify-only:仅输出意图供 workflow 捕获(无需 token)
810807
if args.classify_only:
811808
print(intent)
812809
return 0
813810

811+
# ── 后续操作需要 token ────────────────────────────────────────────
812+
813+
token = os.environ.get("CSM_QA_GH_TOKEN", "")
814+
if not token:
815+
logger.error("CSM_QA_GH_TOKEN 未配置")
816+
return 1
817+
814818
# ── 按意图分派 ───────────────────────────────────────────────────────
815819
if intent == "JOIN":
816820
_handle_join(token, args.discussion_number, args.comment_author, args.dry_run)

0 commit comments

Comments
 (0)