ci: replace PR comment with job summary for clang-format check#7263
ci: replace PR comment with job summary for clang-format check#7263UdjinM6 wants to merge 2 commits intodashpay:developfrom
Conversation
The PR comment approach fails on fork PRs because pull_request events get a read-only GITHUB_TOKEN. Switching to pull_request_target would fix permissions but introduces its own issues: the checkout is the base branch so git ls-files misses files added by the PR, and the three-dot merge-base diff requires deeper clone history. Instead, keep pull_request (correct checkout, full file coverage), remove the comment machinery, and write a short summary to GITHUB_STEP_SUMMARY. The full diff remains visible in the job log. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ No Merge Conflicts DetectedThis PR currently has no conflicts with other open PRs. |
|
✅ Review complete (commit 1682e71) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
WalkthroughThe workflow was changed to remove PR-commenting behavior from the clang-diff-format GitHub Action. Steps that computed Sequence Diagram(s)sequenceDiagram
participant Dev as Developer (push/PR)
participant GH as GitHub Actions Workflow
participant Clang as Clang-format step
participant Log as Job Log / Step Summary
participant API as GitHub REST API (PR Comments)
Dev->>GH: push / open PR
GH->>Clang: run clang-diff-format
Clang-->>GH: diff_output.txt (and file headers)
alt Before change (old flow)
GH->>API: find existing bot comment
API-->>GH: comment found / not found
GH->>API: create/update PR comment (with diff or resolved state)
API-->>GH: comment posted/updated
GH->>Log: (optional) step summary
else After change (new flow)
GH->>Log: write diff_output.txt into job log
GH->>Log: write "Clang Format Style Notes" with affected-files count
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/clang-diff-format.yml:
- Line 21: The file_count grep pattern uses BRE escapes (\( \)) which act as
grouping, so it never matches the literal "(before formatting)"; update the grep
invocation that sets file_count to use extended regex or match literal
parentheses — e.g. change the line that computes file_count (the grep on
diff_output.txt) to use grep -E '^--- .*\(before formatting\)' or remove the
backslashes in the BRE '^--- .*(\(before formatting\))' so the literal
parentheses are matched correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f563822d-c43e-4d34-84bf-98e1f2ca2c31
📒 Files selected for processing (1)
.github/workflows/clang-diff-format.yml
In Basic Regular Expressions (grep default), \( and \) are grouping operators, not literal parentheses. Unescaped ( and ) are literal in BRE. Remove the backslashes so the pattern correctly matches the literal "(before formatting)" in clang-format-diff.py output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
thepastaclaw
left a comment
There was a problem hiding this comment.
Code Review
Clean simplification that replaces verbose PR comment logic with a GitHub Job Summary. Removes the pull-requests:write permission requirement, eliminates 3 third-party action dependencies (peter-evans/find-comment, peter-evans/create-or-update-comment), and reduces the workflow from 69 to 20 lines. The diff output and file count are correctly piped to both the job log and the step summary.
Reviewed commit: 1682e71
Issue being fixed or feature implemented
The PR comment approach #7251 fails on fork PRs because
pull_requestevents get a read-onlyGITHUB_TOKEN. Switching topull_request_target#7262 would fix permissions but introduces its own issues: the checkout is the base branch sogit ls-filesmisses files added by the PR, and the three-dot merge-base diff requires deeper clone history.What was done?
Keep
pull_request(correct checkout, full file coverage), remove the comment machinery, and write a short summary toGITHUB_STEP_SUMMARY. The full diff remains visible in the job log.How Has This Been Tested?
Breaking Changes
Checklist: