ci: lint changed files against PR merge base#3265
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Reviewed by Cursor Bugbot for commit e6fbc01. Configure here.
| } | ||
|
|
||
| function changedFilesBetween(base, head) { | ||
| // actions/checkout uses a shallow checkout, so the PR base commit often is |
There was a problem hiding this comment.
Shallow fetch incompatible with three-dot merge-base diff
Low Severity
The ensureCommitAvailable fallback fetch uses --depth=1, which only retrieves the commit object itself. The new three-dot diff syntax (${base}...${head}) requires git to compute the merge-base by traversing commit history from both refs to a common ancestor. If ensureCommitAvailable actually needs to fetch (i.e., a commit isn't already present), the --depth=1 fetch won't provide enough history for git merge-base to succeed, causing the git diff call to fail. CI is unaffected due to fetch-depth: 0, but the --base flag path for local reproduction is broken in this scenario.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit e6fbc01. Configure here.


Description
Checklist
npm testpass with this change (including linting)?Note
Low Risk
Low risk CI scripting change; main impact is which files get linted on PRs and it could fail if PR SHAs or git history aren’t available as expected.
Overview
Updates the PR lint job to use a full git checkout (
fetch-depth: 0) so merge-base comparisons can be computed reliably.Changes
scripts/lint-changed.mjsto determine changed files on PRs using the GitHub event’s base and head SHAs and a merge-base diff (base...head), ensuring only PR-introduced files are linted; it also now ensures both commits are present locally before diffing.Reviewed by Cursor Bugbot for commit e6fbc01. Bugbot is set up for automated code reviews on this repo. Configure here.