Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/pr-build-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
pull_request:
branches:
- main
- reduceGitFetchTimeForScalpel-base-for-pr
# CI-only changes don't need a full build. Use workflow_dispatch to
# test CI changes: gh workflow run "Build and test" -f pr_number=XXXX -f pr_ref=branch-name
paths-ignore:
Expand Down Expand Up @@ -92,7 +93,7 @@ jobs:
# Scalpel is observational — fetch failures must not break the build.
BASE_REF="${GITHUB_BASE_REF:-main}"
for depth in 50 200 1000; do
git fetch --deepen=$depth 2>/dev/null || true
git fetch --no-tags --deepen=$depth origin ${BASE_REF} 2>/dev/null || true

@apupier apupier Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is it the base_ref or the target pull_request branch (so here main) that we would like to compare?

@gnodet ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

(note that ${BASE_REF} is not working)

git fetch --no-tags --depth=$depth origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" 2>/dev/null || true
if git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
echo "Merge base reachable at depth $depth"
Expand All @@ -103,7 +104,7 @@ jobs:
# If still not reachable, fetch full history as last resort
if ! git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
echo "Merge base still not reachable, fetching full history"
git fetch --unshallow 2>/dev/null || true
git fetch --no-tags --unshallow origin ${BASE_REF} 2>/dev/null || true
git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" 2>/dev/null || true
fi
- id: install-packages
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sonar-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
# Scalpel is observational — fetch failures must not break the build.
BASE_REF="${GITHUB_BASE_REF:-main}"
for depth in 200 1000; do
git fetch --deepen=$depth 2>/dev/null || true
git fetch --no-tags --deepen=$depth origin ${BASE_REF} 2>/dev/null || true
git fetch --no-tags --depth=$depth origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
if git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
echo "Merge base reachable at depth $depth"
Expand All @@ -61,7 +61,7 @@ jobs:
# If still not reachable, fetch full history as last resort
if ! git merge-base HEAD "origin/${BASE_REF}" >/dev/null 2>&1; then
echo "Merge base still not reachable, fetching full history"
git fetch --unshallow 2>/dev/null || true
git fetch --no-tags --unshallow origin ${BASE_REF} 2>/dev/null || true
git fetch --no-tags origin "${BASE_REF}:refs/remotes/origin/${BASE_REF}" || true
fi
- id: install-packages
Expand Down