This is an automated email from the ASF dual-hosted git repository.

apupier pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ba9508e3dca4 Reduce git fetch time for scalpel in GitHub actions
ba9508e3dca4 is described below

commit ba9508e3dca4513b0c987f54e5337a4abca5241c
Author: Aurélien Pupier <[email protected]>
AuthorDate: Thu Sep 3 14:40:19 2026 +0200

    Reduce git fetch time for scalpel in GitHub actions
    
    currently it takes almost 5 minutes. it seems that the `git fetch
    --deepen=50` is fetching last 50 commits of all tags and branches. We
    only need from the base branch.
    Locally, it goes from around 5 minutes to few seconds.
    
    Signed-off-by: Aurélien Pupier <[email protected]>
---
 .github/workflows/pr-build-main.yml | 4 ++--
 .github/workflows/sonar-build.yml   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/pr-build-main.yml 
b/.github/workflows/pr-build-main.yml
index 9938255a7f37..30d0a9143703 100644
--- a/.github/workflows/pr-build-main.yml
+++ b/.github/workflows/pr-build-main.yml
@@ -92,7 +92,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
             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"
@@ -103,7 +103,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
diff --git a/.github/workflows/sonar-build.yml 
b/.github/workflows/sonar-build.yml
index a21e645cc315..15a6dc4097eb 100644
--- a/.github/workflows/sonar-build.yml
+++ b/.github/workflows/sonar-build.yml
@@ -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"
@@ -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

Reply via email to