将 PR Checkstyle 报告同步至 Pull Request 审查评论 - #6692
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c7ef111911
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e940f016e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 346aab98c2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } catch (error) { | ||
| core.error(`Failed to post review comments to GitHub: ${error.message}`); | ||
| } |
There was a problem hiding this comment.
Fail the job when review creation fails
When GitHub rejects the review—for example because a diagnostic has an invalid position—or the API experiences a transient failure, this catch only emits an annotation and then returns normally. core.error does not mark an actions/github-script step as failed, so the dedicated comment workflow finishes successfully despite posting no diagnostics, concealing the malfunction from maintainers; rethrow the error or call core.setFailed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
个人认为此错误完全可以忽略,没必要非得报错吧。
There was a problem hiding this comment.
Pull request overview
新增安全的特权工作流,将 Checkstyle 报告发布为 PR 审查评论。
Changes:
- 生成并上传 reviewdog JSONL 报告。
- 验证 PR 来源后创建行内审查评论。
- 优化脚本的 sparse checkout。
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
.github/workflows/pr-size-label.yml |
精确检出标签脚本。 |
.github/workflows/check-codes.yml |
生成并上传 Checkstyle 报告。 |
.github/workflows/check-codes-comment.yml |
下载报告并触发评论脚本。 |
.github/scripts/check-codes-comment.js |
验证运行来源并发布审查评论。 |
Suppressed comments (1)
.github/scripts/check-codes-comment.js:108
- This catch also leaves the workflow green when the review API rejects the payload, even though its sole purpose was not completed. Mark the step failed or rethrow so maintainers can detect and retry publication failures.
core.error(`Failed to post review comments to GitHub: ${error.message}`);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if (filePath && line) { | ||
| comments.push({ | ||
| path: filePath, | ||
| line, | ||
| side: "RIGHT", |
| commit_id: run.head_sha, | ||
| body: "🤖 Static analysis found the following issues:", | ||
| event: "COMMENT", | ||
| comments: comments |
| core.error(`Failed to fetch PR #${PULL_REQUEST_NUMBER}: ${error.message}`); | ||
| return; |
通过 pull_request 事件触发的工作流是没有发布 review comment 的权限的,因此额外添加了一个 Check Codes Comment 工作流用于将 reviewdog 生成的 jsonl 报告转为 review comment
https://github.com/reviewdog/reviewdog
https://github.com/reviewdog/action-setup
https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
neveler#7