Skip to content

ci: replace PR comment with job summary for clang-format check#7263

Open
UdjinM6 wants to merge 2 commits intodashpay:developfrom
UdjinM6:fix_clang_format_ci_v2
Open

ci: replace PR comment with job summary for clang-format check#7263
UdjinM6 wants to merge 2 commits intodashpay:developfrom
UdjinM6:fix_clang_format_ci_v2

Conversation

@UdjinM6
Copy link
Copy Markdown

@UdjinM6 UdjinM6 commented Mar 31, 2026

Issue being fixed or feature implemented

The PR comment approach #7251 fails on fork PRs because pull_request events get a read-only GITHUB_TOKEN. Switching to pull_request_target #7262 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.

What was done?

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.

How Has This Been Tested?

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

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>
@UdjinM6 UdjinM6 added this to the 24 milestone Mar 31, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 31, 2026

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@thepastaclaw
Copy link
Copy Markdown

thepastaclaw commented Mar 31, 2026

✅ Review complete (commit 1682e71)

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: ff17fcbc-42fd-4df6-9580-d1a31faa7472

📥 Commits

Reviewing files that changed from the base of the PR and between eb7554a and 1682e71.

📒 Files selected for processing (1)
  • .github/workflows/clang-diff-format.yml
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/clang-diff-format.yml

Walkthrough

The workflow was changed to remove PR-commenting behavior from the clang-diff-format GitHub Action. Steps that computed has_diff, built a comment_body.txt, located/created/updated a bot comment on the pull request, and updated that comment to a “resolved” state were deleted. Instead, when diffs are present the action now prints the diff_output.txt into the job log and writes a brief "Clang Format Style Notes" section to the GitHub step summary, including a computed count of affected files parsed from diff headers. Job-level pull-requests: write permission was removed.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: replacing PR comments with job summary for clang-format CI checks.
Description check ✅ Passed The description provides relevant context about the problem being solved, the solution implemented, and explains why the approach was chosen.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca9da3 and eb7554a.

📒 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>
Copy link
Copy Markdown

@thepastaclaw thepastaclaw left a comment

Choose a reason for hiding this comment

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

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

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