diff --git a/scripts/ci/pr_auto_scan.py b/scripts/ci/pr_auto_scan.py index cfe6db8ef..6bef46da2 100644 --- a/scripts/ci/pr_auto_scan.py +++ b/scripts/ci/pr_auto_scan.py @@ -32,7 +32,13 @@ def api_request(token, repo, endpoint, method="GET", data=None): resp = urllib.request.urlopen(req, context=ctx) return json.loads(resp.read().decode()), resp.status except urllib.error.HTTPError as e: - return json.loads(e.read().decode()) if e.read() else {"error": str(e)}, e.code + body = e.read().decode() + if body: + try: + return json.loads(body), e.code + except json.JSONDecodeError: + return {"error": body}, e.code + return {"error": str(e)}, e.code def get_open_prs(token, repo, base="develop"): @@ -269,13 +275,9 @@ def main(): # required contexts(与分支保护一致) REQUIRED_CONTEXTS_FULL = [ - "CI/CD Pipeline / Validate - Code Quality (pull_request)", - "CI/CD Pipeline / Validate - Type Check (mypy) (pull_request)", - "CI/CD Pipeline / Validate - Migration (alembic) (pull_request)", - "CI/CD Pipeline / Frontend Lint (pull_request)", - "CI/CD Pipeline / PR Build API Image (pull_request)", - "CI/CD Pipeline / PR Build Worker Image (pull_request)", - "CI/CD Pipeline / PR Build Web Image (pull_request)", + # 统一使用CI Gate作为合并门禁(与pr-automation和分支保护保持一致) + # CI Gate内部已包含: 代码质量/类型检查/迁移检查/单测/集成测试/前端Lint/前端单测/构建/AI审查 + "CI/CD Pipeline / CI Gate (pull_request)", ] REQUIRED_CONTEXTS_APPROVE = [ "CI/CD Pipeline / Validate - Code Quality (pull_request)", @@ -284,7 +286,8 @@ def main(): "CI/CD Pipeline / Frontend Lint (pull_request)", ] FRONTEND_ONLY_CONTEXT = [ - "CI/CD Pipeline / Frontend Lint (pull_request)", + # 纯前端PR也用CI Gate统一判断,内部自动跳过后端相关检查 + "CI/CD Pipeline / CI Gate (pull_request)", ] # 获取所有open PR