Prefer the PR base SHA when available, but fall back to merge-base against origin/main when the local main branch does not exist in CI checkouts. Also add regression coverage for detached HEAD checkouts without a local main ref.
Assisted-by: Codex:GPT-5.4
The check_no_new_getattr guard could fail when CI checked out a shallow
synthetic PR merge commit, then fetched a newer main tip with --depth=1.
git merge-base failed because the PR base commit wasn't reachable from
the shallow-fetched main ref.
Fix:
- Use GITHUB_BASE_SHA (set by GitHub Actions for PR events) as the stable
base commit reference instead of relying on git merge-base against a
moving, shallow-fetched main branch.
- Remove the now-unnecessary git fetch/bind steps from style.yml.
- Add unit tests for the GITHUB_BASE_SHA fallback in resolve_ci_base.
Fixes#38325