Skip to content

ci(tests): diff affected suites against the merge commit's main parent - #1551

Merged
realcodesiman merged 1 commit into
mainfrom
fix/ci-affected-tests-base
Oct 24, 2026
Merged

realcodesiman merged 1 commit into
mainfrom
fix/ci-affected-tests-base

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Problem

Test affected workspaces (added in #1522) ran almost every suite on PRs that touch a handful of files — e.g. #1398 changes 8 files but tested 62 workspaces, including utils, logger, vitest-config.

TURBO_SCM_BASE was github.event.pull_request.base.sha, which stays at the main commit the PR branch was last synced with. TURBO_SCM_HEAD is the checked-out merge commit, which GitHub builds on the current main tip. Once main moves, the diff includes every main commit merged since (4040 files for #1398), including root package.json, pnpm-lock.yaml and turbo.json — so turbo marks every workspace affected.

Fix

Use the merge commit's first parent (HEAD^1) as the base — that is exactly the main tip the PR was merged onto, so the diff is just the PR's own changes. fetch-depth: 0 is already set, so the parent is available.

Verification

Dry run against #1398's real merge commit b243fa0:

base files in diff affected packages
pull_request.base.sha (e4913ef) 4040 62
HEAD^1 (270eb50) 8 24

(24 is expected: #1398 touches packages/database, which pulls in its dependents.)

Test plan

  • CI on this PR: Test affected workspaces runs and the scope matches the PR's diff

🤖 Generated with Claude Code

pull_request.base.sha stays at the main commit a PR branch was last synced
with, while the checked-out merge commit is built on the current main tip.
Diffing the two pulled every main commit merged since into the change set
(root package.json, lockfile, turbo.json), so turbo marked all workspaces
affected. Use HEAD^1, the exact main tip the PR was merged onto.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions github-actions Bot added the ci CI/CD pipeline changes label Oct 24, 2026
@realcodesiman
realcodesiman merged commit 18be04b into main Oct 24, 2026
5 checks passed
@realcodesiman
realcodesiman deleted the fix/ci-affected-tests-base branch October 24, 2026 08:33
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
…t (#1551)

pull_request.base.sha stays at the main commit a PR branch was last synced
with, while the checked-out merge commit is built on the current main tip.
Diffing the two pulled every main commit merged since into the change set
(root package.json, lockfile, turbo.json), so turbo marked all workspaces
affected. Use HEAD^1, the exact main tip the PR was merged onto.

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci CI/CD pipeline changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant