fix(action): exclude base-branch drift from PR changed-file detection - #1447
Draft
skoshx wants to merge 2 commits into
Draft
fix(action): exclude base-branch drift from PR changed-file detection#1447skoshx wants to merge 2 commits into
skoshx wants to merge 2 commits into
Conversation
The v2 action's local git diff compared `base.sha...HEAD` where `HEAD` is the synthetic merge commit created by `actions/checkout`, which included base-branch drift when the base moved ahead since the PR was opened. Now compares `base.sha...head.sha` (event's head SHA) instead, preventing drift from appearing as PR changes. Regression test added to verify the fix excludes drift files from the changed-file list. Closes #1446 Co-authored-by: Skosh <skoshx@users.noreply.github.com>
Contributor
📦 GitHub Action release recommendedThis PR changes the React Doctor GitHub Action's release surface:
The composite action is versioned independently from the npm packages, so it After merging, cut the tag from the merge commit on git checkout main && git pull --ff-only
merge_commit=$(git rev-parse HEAD)
git tag -a v2.2.9 "$merge_commit" -m "react-doctor action v2.2.9"
git tag -fa v2 "$merge_commit" -m "react-doctor action v2 (floating major -> v2.2.9)"
git push origin v2.2.9
git push --force origin v2 # moves only the floating major pointerThis bump can also be performed automatically on merge — set the repo |
commit: |
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Co-authored-by: Skosh <skoshx@users.noreply.github.com>
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.
Root Cause
The v2 action's local git diff compared
base.sha...HEADwhereHEADis the synthetic merge commit created byactions/checkout. When the base branch has moved ahead since the PR was opened, this synthetic merge includes base-branch drift, causing those drift files to appear as PR changes.Fix
Compare
base.sha...head.sha(usinggithub.event.pull_request.head.sha) instead ofHEAD, ensuring only actual PR changes are included in the changed-file list.Scope
Changed only the action's git diff calculation. The CLI is unchanged. A regression test verifies that drift files (15 commits added to base after PR creation) are excluded from the changed-file list.
Testing
Parity
Since this is an action-only fix (git diff calculation), it doesn't affect CLI behavior or diagnostic logic. The OSS corpus that parity scans is checked out at specific commits, not PR merge refs, so parity is N/A for this fix.
Closes #1446