File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 8484 if : ${{ !inputs.skip_full_build }}
8585 run : |
8686 # Scalpel needs the merge base between HEAD and the base branch.
87- # The checkout is depth=1, so deepen both sides for merge-base reachability.
88- git fetch --deepen=200 2>/dev/null || true
89- git fetch --no-tags --depth=200 origin "${GITHUB_BASE_REF:-main}:refs/remotes/origin/${GITHUB_BASE_REF:-main}"
87+ # The checkout is depth=1, so we progressively deepen until the
88+ # merge base is reachable: 200 → 1000 → full history.
89+ # Scalpel is observational — fetch failures must not break the build.
90+ BASE_REF="${GITHUB_BASE_REF:-main}"
91+ for depth in 200 1000; do
92+ git fetch --deepen=$depth 2>/dev/null || true
93+ git fetch --no-tags --depth=$depth origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
94+ if git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
95+ echo "Merge base reachable at depth $depth"
96+ break
97+ fi
98+ echo "Merge base not reachable at depth $depth, deepening..."
99+ done
100+ # If still not reachable, fetch full history as last resort
101+ if ! git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
102+ echo "Merge base still not reachable, fetching full history"
103+ git fetch --unshallow 2>/dev/null || true
104+ git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
105+ fi
90106 - id : install-packages
91107 uses : ./.github/actions/install-packages
92108 - id : install-mvnd
Original file line number Diff line number Diff line change 4747 persist-credentials : false
4848 - name : Fetch base branch for Scalpel change detection
4949 run : |
50- git fetch --deepen=200 2>/dev/null || true
51- git fetch --no-tags --depth=200 origin "${GITHUB_BASE_REF:-main}:refs/remotes/origin/${GITHUB_BASE_REF:-main}"
50+ # Scalpel is observational — fetch failures must not break the build.
51+ BASE_REF="${GITHUB_BASE_REF:-main}"
52+ for depth in 200 1000; do
53+ git fetch --deepen=$depth 2>/dev/null || true
54+ git fetch --no-tags --depth=$depth origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
55+ if git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
56+ echo "Merge base reachable at depth $depth"
57+ break
58+ fi
59+ echo "Merge base not reachable at depth $depth, deepening..."
60+ done
61+ # If still not reachable, fetch full history as last resort
62+ if ! git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
63+ echo "Merge base still not reachable, fetching full history"
64+ git fetch --unshallow 2>/dev/null || true
65+ git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
66+ fi
5267 - id : install-packages
5368 uses : ./.github/actions/install-packages
5469
You can’t perform that action at this time.
0 commit comments