ci: PR 阶段格式检查并在合并后修复 - #515
Conversation
审查者指南该 PR 新增 PR 阶段的只读格式检查,覆盖 Python、前端代码和 Markdown,并将原定时格式化改为 dev 合并后的独立写权限自动修复流程;同时将前端格式与 lint 工具从 ESLint/Prettier 迁移到 oxlint/oxfmt,并加入 Markdownlint 及对应配置。 PR 格式检查与合并后修复的时序图sequenceDiagram
participant PR as PullRequest
participant Check as FormatCheckWorkflow
participant Repo as Repository
participant Fix as FormatFixWorkflow
PR->>Check: opened / synchronize / reopened
Check->>Repo: actions/checkout
Check->>Check: ruff format --check .
Check->>Check: yarn oxfmt . --check
Check->>Check: yarn lint:md
PR->>Fix: merged into dev
Fix->>Repo: checkout dev
Fix->>Fix: yarn format
Fix->>Fix: yarn lint:md:fix
Fix->>Repo: commit and push formatting changes
文件级变更
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板,即可:
获取帮助Original review guide in EnglishReviewer's Guide该 PR 新增 PR 阶段的只读格式检查,覆盖 Python、前端代码和 Markdown,并将原定时格式化改为 dev 合并后的独立写权限自动修复流程;同时将前端格式与 lint 工具从 ESLint/Prettier 迁移到 oxlint/oxfmt,并加入 Markdownlint 及对应配置。 Sequence diagram for PR format checking and post-merge fixingsequenceDiagram
participant PR as PullRequest
participant Check as FormatCheckWorkflow
participant Repo as Repository
participant Fix as FormatFixWorkflow
PR->>Check: opened / synchronize / reopened
Check->>Repo: actions/checkout
Check->>Check: ruff format --check .
Check->>Check: yarn oxfmt . --check
Check->>Check: yarn lint:md
PR->>Fix: merged into dev
Fix->>Repo: checkout dev
Fix->>Fix: yarn format
Fix->>Fix: yarn lint:md:fix
Fix->>Repo: commit and push formatting changes
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
嘿——我发现了 1 个问题
已修复的安全问题:
面向 AI Agent 的提示
请处理本次代码审查中的评论:
## 单独评论
### 评论 1
<location path=".github/workflows/format-check.yml" line_range="59" />
<code_context>
+
+ - name: 检查前端 Markdown Lint
+ working-directory: frontend
+ run: yarn lint:md
</code_context>
<issue_to_address>
**issue (broader_impact):** PR 工作流从未运行 `yarn lint`,因此即使合并后的工作流会运行 `yarn lint:fix` 并随后重写已合并的代码,oxlint 错误仍然可以通过 PR 检查。
**触发条件:** 当 PR 包含不会影响 Ruff、oxfmt 或 Markdown 检查的 oxlint 错误时。
**建议修复:** 在 PR 工作流中添加一个只读的 `yarn lint` 步骤;或者,如果 lint 有意不在此次检查范围内,则从合并后的格式化工作流中移除 `yarn lint:fix`。
</issue_to_address>Sourcery 评估
需要人工审查。 首先需要处理 1 个发现的问题。此外,新的 pull_request_target 工作流授予了 contents: write 权限,并会在合并后自动运行格式化程序,将更改提交到 dev 分支。因此,工作流或工具错误可能会创建在还原此 PR 后仍然存在的仓库更改。这些提交的影响范围有限且可以还原,但 CI 信任边界的变化以及格式化程序/代码检查工具依赖的大范围迁移值得进行人工审查。
阻塞性发现:.github/workflows/format-check.yml:59
请帮助我变得更有用!请在每条评论上点击 👍 或 👎,我会利用反馈来改进审查结果。
Original comment in English
Hey - I've found 1 issue
Fixed security issues:
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/format-check.yml" line_range="59" />
<code_context>
+
+ - name: 检查前端 Markdown Lint
+ working-directory: frontend
+ run: yarn lint:md
</code_context>
<issue_to_address>
**issue (broader_impact):** The PR workflow never runs `yarn lint`, so oxlint errors are allowed through PR checks even though the post-merge workflow runs `yarn lint:fix` and can subsequently rewrite the merged code.
**Triggers:** When a PR contains an oxlint error that does not affect Ruff, oxfmt, or Markdown checks.
**Suggested fix:** Add a read-only `yarn lint` step to the PR workflow, or remove `yarn lint:fix` from the post-merge formatter if lint is intentionally outside this check.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and the new pull_request_target workflow grants contents: write and automatically runs formatting and commits changes to the dev branch after merges, so a workflow or tooling mistake can create repository changes that remain after reverting this PR. Those commits are bounded and can be reverted, but the changed CI trust boundary and broad formatter/linter dependency migration warrant human review.
Blocking findings: .github/workflows/format-check.yml:59
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| - name: 检查前端 Markdown Lint | ||
| working-directory: frontend | ||
| run: yarn lint:md |
There was a problem hiding this comment.
issue (broader_impact): PR 工作流从未运行 yarn lint,因此即使合并后的工作流会运行 yarn lint:fix 并随后重写已合并的代码,oxlint 错误仍然可以通过 PR 检查。
触发条件: 当 PR 包含不会影响 Ruff、oxfmt 或 Markdown 检查的 oxlint 错误时。
建议修复: 在 PR 工作流中添加一个只读的 yarn lint 步骤;或者,如果 lint 有意不在此次检查范围内,则从合并后的格式化工作流中移除 yarn lint:fix。
Original comment in English
issue (broader_impact): The PR workflow never runs yarn lint, so oxlint errors are allowed through PR checks even though the post-merge workflow runs yarn lint:fix and can subsequently rewrite the merged code.
Triggers: When a PR contains an oxlint error that does not affect Ruff, oxfmt, or Markdown checks.
Suggested fix: Add a read-only yarn lint step to the PR workflow, or remove yarn lint:fix from the post-merge formatter if lint is intentionally outside this check.
|
当前似乎ruff check过不了,等等吧() |
|
自动format可以和签名放到一个工作流吧 |
Sourcery 摘要
统一整个项目的格式检查,并为 dev 自动化合并后的修复。
新功能:
改进:
CI:
文档:
维护:
Original summary in English
Sourcery 摘要
统一项目格式检查,并在更改合并到 dev 后自动执行修复。
新功能:
增强功能:
构建:
CI:
文档:
Original summary in English
Sourcery 总结
添加只读的拉取请求格式验证,并在变更合并到 dev 后自动修复格式。
新功能:
增强功能:
构建:
CI:
文档:
Original summary in English
Sourcery 摘要
标准化项目格式检查,并自动修复 dev 分支合并后的格式问题。
新功能:
改进:
构建:
持续集成:
文档:
Original summary in English
Summary by Sourcery
Standardize project formatting checks and automate post-merge fixes for the dev branch.
New Features:
Enhancements:
Build:
CI:
Documentation: