Skip to content

fix: skip auto-fix when HEAD is not the commit that triggered the workflow (v3) - #530

Merged
2bndy5 merged 1 commit into
v3.0.0-rc0from
claude/project-thread-y4qppu-v3
Nov 13, 2026
Merged

2bndy5 merged 1 commit into
v3.0.0-rc0from
claude/project-thread-y4qppu-v3

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

The same change as #529, for the v3.0.0-rc0 branch (the commit is a clean cherry-pick). #529 has the full description.

Summary

On events that carry no pull request (issue_comment, workflow_run, schedule, workflow_dispatch), the auto-fix step pushes HEAD to GITHUB_REF_NAME, usually the default branch. If the workflow checked out another commit there, such as a pull request's head, that commit and its ancestors were pushed to the default branch together with the fix commit.

Now auto-fix only commits when HEAD is GITHUB_SHA on those events, and is skipped with a warning otherwise. push and pull_request workflows are not affected.

Testing

Run on real runners in cpp-linter/test-cpp-linter-action with this branch (cpp-linter 2.0.0rc24, clang 18, ubuntu-latest). The stand-in for "a pull request's head is checked out" is an extra empty commit made after actions/checkout.

Case Result
HEAD ahead of GITHUB_SHA skipped with the warning, branch not moved (run)
HEAD is GITHUB_SHA (plain push) fix commit pushed as before (run)

If you would rather pick this up when rebasing the branch onto main after #529, feel free to close this one.

…kflow

On events without a pull request (issue_comment, workflow_run, schedule,
workflow_dispatch) the auto-fix commit is pushed to GITHUB_REF_NAME, which
is usually the default branch. If the workflow checked out another commit
there, such as a pull request's head, the push put that commit and its
ancestors on the default branch along with the formatting commit.

Only commit when HEAD is GITHUB_SHA on those events, and skip with a
warning otherwise.
@shenxianpeng
shenxianpeng requested a review from a team as a code owner November 13, 2026 06:08
@shenxianpeng
shenxianpeng requested review from 2bndy5 and removed request for a team November 13, 2026 06:09
@shenxianpeng shenxianpeng added the bug Something isn't working label Nov 13, 2026 — with Claude
@github-actions github-actions Bot added bug Something isn't working documentation Improvements or additions to documentation labels Nov 13, 2026
@shenxianpeng shenxianpeng self-assigned this Nov 13, 2026
@2bndy5
2bndy5 merged commit 0e8e5a7 into v3.0.0-rc0 Nov 13, 2026
4 checks passed
@2bndy5
2bndy5 deleted the claude/project-thread-y4qppu-v3 branch November 13, 2026 06:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants