Skip to content

refactor(ci): issues 自动化 - #233

Merged
Lin-arm merged 90 commits into
Lin-arm:mainfrom
cjy0812:main
Jul 22, 2026
Merged

refactor(ci): issues 自动化#233
Lin-arm merged 90 commits into
Lin-arm:mainfrom
cjy0812:main

Conversation

@cjy0812

@cjy0812 cjy0812 commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator
PixPin_2026-07-17_01-10-58

测试靶场

TODO

Details

初始阶段

有快照

本地链接(Tag+评论[不close])

不提供的(ban!)

PixPin_2026-07-13_03-44-27

404链接


混合

PixPin_2026-07-13_04-04-20

第二阶段

测试


  • 测试:提交含 GitHub 附件快照的 Issue → Action 触发 → Bot 评论包含解析后的主区域+折叠区
  • 测试:提交含 GKD 分享链接的 Issue → Action 触发 → 链接原样保留,不出现双重代理嵌套
    - [ ] 测试:同 App 同 Activity 多快照 Issue → Bot 评论只展示一个代表 Activity 行,其余只记链接 (幻觉!)
  • 测试:快照下载失败(如无效附件)→ Action 不崩溃,链接仍出现在 Bot 评论中
  • 测试:不可访问快照链接 Issue → 原有警告流程不受影响
  • 测试:链接 404 / 不确定 → 原有阻断转换流程不受影响
  • 测试:缺失快照 Issue → 原有警告+关闭流程不受影响

  • 测试:Recovery 场景(编辑补充有效链接)→ 恢复流程正常
  • 清理工程文件

@cjy0812

This comment was marked as resolved.

@Lin-arm

This comment was marked as resolved.

@Lin-arm

This comment was marked as off-topic.

@cjy0812

This comment was marked as resolved.

@Lin-arm

This comment was marked as resolved.

cjy0812 added 25 commits July 10, 2026 21:32
- Python脚本模块处理
  1. Issue 快照链接检查主入口
  2. 链接检查模块
  3. 链接转换与 Bot 评论生成模块
  4. 链接提取模块
- ci流程
docs: 更新流程图和 Job 表反映链式依赖
cjy0812 added 5 commits July 13, 2026 15:46
- 移除 handle-convert 对 handle-network-404/uncertain 的依赖,有好链接时正常转换
- 移除 find-bot 步骤和 comment-id 参数,改为创建新评论而非覆盖旧评论
- 旧 Bot 评论被折叠为 OUTDATED,新评论独立存在
- extract_links_from_bot_comment 现在使用原始 URL 而不是构建新 URL
- 确保从旧 Bot 评论提取的链接能正确用于快照解析
- 使用 jq 的 first // empty 语法获取第一个匹配的 Bot 评论
- 移除 head -1 避免截断多行 body 内容
- 确保历史链接能正确传递给 Python 代码进行合并
@cjy0812

cjy0812 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

@Lin-arm 我已经完成大约80%测试,你可以看一下md是否符合预期,没问题的话就剩下审查清理和最后bug测试了

看得我头大🤯

额光md就有很多,忘告诉说agens/ci.md,其他是托

cjy0812 added 10 commits July 15, 2026 14:13
- 添加 || true 防止 gh api 返回空结果时导致步骤失败
- 使用成熟的 Action 替代手动 gh api + jq 调用
- 更可靠地处理多行评论内容
- 简化代码,移除 fallback 逻辑
- 将 steps.find-old-bot.outputs.comment-body 改为通过 env 传递
- 避免评论内容中的反引号被 shell 解释为命令替换
- 修复 com.eg.android.AlipayGphone: command not found 错误
- GraphQL API 返回 github-actions (不带方括号)
- REST API 返回 github-actions[bot] (带方括号)
- 将查询条件从 github-actions[bot] 改为 github-actions
- 修复旧 Bot 评论无法被隐藏的问题
- 新增 api/base.py: URLChecker 基类,支持多场景扩展
- 新增 api/issue_checker.py: Issue 场景检查器
- 新增 utils/cache.py: 统一缓存管理
- 重构 core/checker.py: 使用 httpx 替代 urllib,支持并发检查
- 重构 entry/check_issue.py: 使用 IssueChecker,代码减少 80%
- 重构 debug_sim.py: 使用 IssueChecker,消除重复代码
- 删除 api/link_checker.py: 被 base.py 和 issue_checker.py 替代
- 提取公共常量 SNAPSHOT_KINDS 到 utils/common.py

主要改进:
1. 面向对象架构,支持继承扩展(PR/Commit 场景)
2. 使用 httpx 替代 urllib,代码更简洁
3. 统一缓存管理,消除重复实现
4. 代码量减少约 40%
5. 为未来并发检查预留接口
- 更新 scripts/python/README.md:
  - 目录结构树(新增 base.py, issue_checker.py, cache.py)
  - 模块职责表格(更新 api/ 和 utils/ 描述)
  - 使用方式示例(使用 IssueChecker 替代 LinkChecker)
  - 依赖关系图(反映新的模块依赖)
  - 新增架构优势说明

- 更新 .claude/rules/ci-cd.md:
  - Python 模块结构树(同步最新目录结构)
  - Python 脚本说明(新增 base.py, issue_checker.py, cache.py 描述)
- 在配置 Python 环境后添加 pip install httpx 步骤
- 修复 ModuleNotFoundError: No module named 'httpx' 错误
- 恢复 core/checker.py 使用 httpx 的实现
@cjy0812 cjy0812 closed this Jul 16, 2026
@cjy0812

cjy0812 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

???

@cjy0812 cjy0812 reopened this Jul 16, 2026
cjy0812 added 5 commits July 16, 2026 23:03
- 修复 GKD 信息回退位置:从 device 对象读取 gkdVersionName/gkdVersionCode
- 添加 quickFind 字段兼容(2023-10-16 ~ 2024-01 快照)
- 添加 isClickable 回退兼容旧版快照
- 添加 is_legacy_snapshot 标记,输出旧版格式警告
- 更新测试用例适配新输出格式
@cjy0812

cjy0812 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

@Lin-arm 这种运行效果你觉得如何? cjy0812#153

想要了解其中实现细节?

@cjy0812

cjy0812 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator Author

算了,明天晚上再review,太多了🥲

Comment thread .claude/rules/architecture.md
Comment thread .claude/rules/ci-cd.md
Comment thread .claude/rules/ci-cd.md
Comment thread .claude/rules/conventions.md
Comment thread .claude/settings.json
"""
return extract_links(text)

def check_url(self, url: str) -> NetworkResult:

This comment was marked as duplicate.

# ── 网络有效性检查 ──


def check_network_links(url: str, timeout: int = 20) -> "NetworkResult":

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjy0812 孩子们请问是异步操作吗?

Comment on lines +29 to +30
# GitHub 附件链接:https://github.com/user-attachments/files/...
_RE_GITHUB_ATTACHMENT = re.compile(r"https://github\.com/user-attachments/files/[^\s\)]+")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_RE_UNREACHABLE_SNAPSHOT = re.compile(r"https://i\.gkd\.li/snapshot/[^\s\)]*")

# GKD 代理链接:https://i.gkd.li/i?url=...
_RE_GKD_PROXY_LINK = re.compile(r"https://i\.gkd\.li/i\?url=(https://[^\s\)]+)")

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上https://github\.com/user-attachments/files/\d+/(.+)")

# 旧版兼容:使用 quickFind 字段(同时作为 idQf 和 textQf)
quick_find = node.get("quickFind")
if quick_find is True:
id_qf_count += 1

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

新旧不分为何要双计数?

@Lin-arm Lin-arm left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

太多了,只能粗劣看看

Comment thread .claude/rules/ci-cd.md
Comment thread .claude/rules/architecture.md
Comment thread .claude/rules/ci-cd.md
Comment thread .claude/rules/conventions.md
Comment thread docs/api/snapshot.md
converted_url: str

# 旧版快照标记
is_legacy_snapshot: bool = False # 是否为旧版快照(缺少 appInfo/gkdAppInfo)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

旧快照至少有两种
一种是 有快查但无vid ;更旧的一种是 无快查也无vid

Comment thread .gitignore
Comment thread CLAUDE.md
@Lin-arm
Lin-arm merged commit eef28d1 into Lin-arm:main Jul 22, 2026
1 check passed
@cjy0812

This comment was marked as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants