Skip to content

ci(BA-4852): use full clone to support fork PRs CI#9617

Open
fregataa wants to merge 4 commits intomainfrom
BA-4852
Open

ci(BA-4852): use full clone to support fork PRs CI#9617
fregataa wants to merge 4 commits intomainfrom
BA-4852

Conversation

@fregataa
Copy link
Member

@fregataa fregataa commented Mar 3, 2026

Summary

  • Fix CI lint/test failure on fork PRs caused by fatal: no merge base error
  • Detect fork PRs by comparing head.repo.full_name vs base.repo.full_name
  • Use fetch-depth: 0 (full clone) for fork PRs in both lint-and-typecheck and test jobs, while preserving the existing shallow clone optimization for same-repo PRs

Why full clone instead of requiring fork sync?

Fork PRs may diverge far from upstream, making the shallow clone's history insufficient to find a merge base. While contributors could sync their fork before submitting, requiring this adds unnecessary friction for external contributors. The CI should work regardless of how far the fork has diverged.

Test plan

  • Verify existing same-repo PRs still use shallow clone (no behavior change)
  • Verify fork PRs use full clone and pants --changed-since succeeds

Resolves BA-4852

Copilot AI review requested due to automatic review settings March 3, 2026 12:33
@github-actions github-actions bot added the size:S 10~30 LoC label Mar 3, 2026
fregataa added a commit that referenced this pull request Mar 3, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates CI checkout/fetch behavior to avoid fatal: no merge base failures on fork PRs by switching those runs to a full Git history.

Changes:

  • Detect fork PRs by comparing head.repo.full_name and base.repo.full_name.
  • Use fetch-depth: 0 for fork PRs while retaining shallow fetch for same-repo PRs.
  • Adjust base SHA fetching to avoid shallow-history merge-base failures on fork PRs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
changes/9617.fix.md Adds a changelog entry describing the CI fix.
.github/workflows/ci.yml Implements fork PR detection and conditionally uses full clone / non-shallow base SHA fetch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fregataa fregataa requested review from a team and Yaminyam March 3, 2026 12:43
@github-actions github-actions bot added size:M 30~100 LoC and removed size:S 10~30 LoC labels Mar 3, 2026
Copy link
Collaborator

@HyeockJinKim HyeockJinKim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please refrain from including "fix" in PR titles or changelogs for CI modification work. The "fix" label should only be applied to bug fixes within our service.

@fregataa fregataa changed the title fix(BA-4852): use full clone for fork PRs to fix merge-base failure ci(BA-4852): use full clone for fork PRs to fix merge-base failure Mar 6, 2026
@fregataa fregataa changed the title ci(BA-4852): use full clone for fork PRs to fix merge-base failure ci(BA-4852): use full clone to support fork PRs CI Mar 6, 2026
@fregataa fregataa requested review from a team and HyeockJinKim March 6, 2026 06:57
fregataa and others added 4 commits March 6, 2026 17:33
Fork PRs have diverged history from upstream, so the shallow fetch
(PR commits + 1) doesn't include enough common ancestors for
git merge-base to work. Detect fork PRs by comparing head and base
repo names, and use fetch-depth: 0 for full history in that case.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Compute IS_FORK_PR once in the "Calculate the fetch depth" step of each
job (lint-and-typecheck, test) and reference the env var in subsequent
steps instead of repeating the full_name comparison.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30~100 LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants