fix: repair clang-format CI for fork PRs and push events#2731
Merged
Conversation
- Use commit SHAs from GitHub context instead of remotes/origin/<branch> names, which don't exist for PRs from forks - Handle push events separately (GITHUB_HEAD/BASE_REF are empty on push) - Bump actions/checkout v3 -> v6, actions/upload-artifact v4 -> v7 - Remove redundant `git fetch --all` Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
henningjp
added a commit
to henningjp/CoolProp
that referenced
this pull request
Apr 17, 2026
3 tasks
henningjp
approved these changes
Apr 17, 2026
Contributor
henningjp
left a comment
There was a problem hiding this comment.
Nice. Verified PR behavior from forked repos using #2732 draft PR.
- Looked like it passed (no artifacts generated)
So, I intentionally messed with the code format in another commit.
- It successfully failed the clang-format test.
- It successfully uploaded the clang-format repair artifact.
I don't know how to check the second Test Plan item from master/develop branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #2724 — the
dev_clangformatworkflow was silently passing on the majority of PRs.remotes/origin/$GITHUB_HEAD_REF/remotes/origin/$GITHUB_BASE_REFwith commit SHAs from the GitHub Actions context (github.event.pull_request.base.shaandgithub.sha). The fork's branch is never fetched intoorigin, so the old ref always resolved to nothing andgit diffreported 0 changed files.GITHUB_HEAD_REFandGITHUB_BASE_REFare only populated forpull_requestevents, notpush. The fix detects the event type and usesgithub.event.before/github.shafor push events.actions/checkoutv3 → v6 andactions/upload-artifactv4 → v7 (both at latest stable).git fetch --all(not needed sincefetch-depth: 0already fetches everything and we now use SHAs).Test plan
.cpp/.hfilesmaster/developruns the diff againstgithub.event.before🤖 Generated with Claude Code