Skip to content

fix(action): exclude base-branch drift from PR changed-file detection - #1447

Draft
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1446-61c0
Draft

fix(action): exclude base-branch drift from PR changed-file detection#1447
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1446-61c0

Conversation

@skoshx

@skoshx skoshx commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Root Cause

The v2 action's local git diff compared base.sha...HEAD where HEAD is the synthetic merge commit created by actions/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 (using github.event.pull_request.head.sha) instead of HEAD, 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

  • Added regression test that creates a PR with base-branch drift and confirms only the PR's actual change appears in the changed-file list
  • All existing tests pass
  • Lint and typecheck pass

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

Open in Web Open in Cursor 

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>
@github-actions

Copy link
Copy Markdown
Contributor

📦 GitHub Action release recommended

This PR changes the React Doctor GitHub Action's release surface:

  • action.yml

The composite action is versioned independently from the npm packages, so it
needs its own git tag once this merges. Based on the PR title, this looks like
a patch bump (fix / refactor / chore / docs): v2.2.8v2.2.9.

After merging, cut the tag from the merge commit on main (tags are GPG-signed
annotated tags, so run this locally where your signing key is configured):

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 pointer

This bump can also be performed automatically on merge — set the repo
variable AUTO_BUMP_ACTION_TAG=true. Recommendation by the Action Version Bump workflow.

@pkg-pr-new

pkg-pr-new Bot commented Jul 24, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1447
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1447
npm i https://pkg.pr.new/react-doctor@1447

commit: 0c27ba7

@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 0c27ba7.

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
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.

v2 changed-file discovery includes base-branch drift from PR merge checkout

2 participants