test: auto-fix pull-request e2e (do not merge) - #61
Open
shenxianpeng wants to merge 2 commits into
Open
Conversation
Phase 1 covers the push path. This adds the half only a real pull request can reach: the step that moves the runner off the PR merge ref and onto the PR head branch, its same-repository gating, and pushing the fix back so the pull request updates itself. Neither cpp-linter-action#443 nor cpp-linter#202 has to be merged — the action is consumed from its PR branch as a local action and its pinned cpp-linter version is rewritten in the runner's workspace. Scans only the files this pull request changes, because src/demo.cpp and src/demo.hpp are intentionally unformatted fixtures that auto-fix would otherwise repair and commit; the check asserts they stay untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012uXrN1wk5EaqK5GimN3deT
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.
Purpose
Test scaffolding — not for merging. This PR exists so the
auto-fixfeature can be exercised on a real pull request while both of the PRs it depends on are still open:auto-fixinput--fixCLI flagNeither needs to be merged. The action is checked out at its PR branch and consumed as a local action, and the
cpp-linterversion it pins (==1.13.0, which has no--fix) is rewritten in the runner's workspace to install from the cpp-linter PR branch. Nothing is patched in either upstream repository.What this covers that phase 1 did not
Phase 1 (
auto-fix-e2e.yml, on the push path) already passed: the file was reformatted, committed asstyle: apply clang-format fixes, authored fromGITHUB_ACTOR, and pushed.This phase reaches the half only a real pull request can:
How it works
src/e2e_autofix_pr_demo.cppis committed deliberately malformed. When the workflow runs, auto-fix should reformat it and add a commit to this branch.The job asserts: the runner switched to the head branch, the fixture changed, a commit exists with the configured message, the result satisfies
.clang-format, the commit reached the remote — and thatsrc/demo.cpp/src/demo.hppwere left untouched.That last check matters: those two files are intentionally unformatted fixtures of this repo, so the linter is scoped with
files-changed-only: true. Without it, auto-fix would "repair" and commit them.The workflow is gated on
startsWith(github.head_ref, 'test/auto-fix-pr-e2e'), so it can never run for a real pull request.Cleanup
Close this PR and delete the branch once the run has been reviewed.
Generated by Claude Code