Skip to content

将 PR Checkstyle 报告同步至 Pull Request 审查评论 - #6692

Merged
Glavo merged 2 commits into
HMCL-dev:mainfrom
neveler:reviewdog
Aug 20, 2026
Merged

Glavo merged 2 commits into
HMCL-dev:mainfrom
neveler:reviewdog

Conversation

@neveler

@neveler neveler commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

通过 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/
https://github.com/neveler/HMCL/pull/8


image

@github-actions github-actions Bot added the 1+ label Aug 16, 2026
@neveler neveler changed the title Update check-codes.yml configuration 为代码检查集成 reviewdog Aug 16, 2026
@Glavo

Glavo commented Aug 16, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread .github/workflows/check-codes.yml Outdated
@neveler
neveler marked this pull request as draft August 16, 2026 15:41
@neveler neveler changed the title 为代码检查集成 reviewdog 为 PR 增加自动发布 checkstyle 审查评论的功能 Aug 17, 2026
@github-actions github-actions Bot added 40+ and removed 1+ labels Aug 17, 2026
@github-actions github-actions Bot added 1+ and removed 40+ labels Aug 17, 2026
@neveler neveler changed the title 为 PR 增加自动发布 checkstyle 审查评论的功能 为代码检查集成 reviewdog Aug 17, 2026
@neveler
neveler marked this pull request as ready for review August 17, 2026 07:00
@Glavo

Glavo commented Aug 17, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread .github/workflows/check-codes.yml Outdated
@neveler
neveler marked this pull request as draft August 17, 2026 22:44
@github-actions github-actions Bot added 100+ and removed 1+ labels Aug 18, 2026
@neveler neveler changed the title 为代码检查集成 reviewdog 将 PR Checkstyle 报告同步至 Pull Request 审查评论 Aug 18, 2026
@neveler
neveler marked this pull request as ready for review August 18, 2026 00:32
@Glavo

Glavo commented Aug 19, 2026

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread .github/scripts/check-codes-comment.js Outdated
Comment thread .github/scripts/check-codes-comment.js
@Glavo
Glavo requested a balanced review from Copilot August 19, 2026 13:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment thread .github/scripts/check-codes-comment.js Outdated
Comment thread .github/scripts/check-codes-comment.js
Comment thread .github/scripts/check-codes-comment.js Outdated
@Glavo
Glavo requested a balanced review from Copilot August 20, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

.github/scripts/check-codes-comment.js:106

  • Each rerun of the same failed Check Codes workflow emits another workflow_run event, and this unconditional call creates an identical review for the same commit. Re-running a failed check will therefore duplicate all bot comments. Before creating the review, detect an existing bot review for this workflow marker and run.head_sha (or otherwise make publication idempotent).
        await github.rest.pulls.createReview({

Comment thread .github/workflows/check-codes.yml
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@neveler

neveler commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Each rerun of the same failed Check Codes workflow emits another workflow_run event, and this unconditional call creates an identical review for the same commit. Re-running a failed check will therefore duplicate all bot comments. Before creating the review, detect an existing bot review for this workflow marker and run.head_sha (or otherwise make publication idempotent).

普通用户没有重新运行工作流的权限;即便重新执行,也只是额外触发一次审核评论。综合评估实现成本与带来的收益,个人认为该方案性价比不高,没有实现的必要。

@Glavo
Glavo merged commit f7bf2d4 into HMCL-dev:main Aug 20, 2026
2 checks passed
@neveler
neveler deleted the reviewdog branch August 20, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants