From 8fefbc019eabc436a2761271ec472e1e7e1bf2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 3 Sep 2026 14:40:19 +0200 Subject: [PATCH 1/2] Reduce git fetch time for scalpel in GitHub actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .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 e066df2a41ffe..82e660cfd44db 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 b6f5c100896e0..d1bbc3e99be6a 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 From 9c78543e806fab0b0dd2115a764209b5c9f1360f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Pupier?= Date: Thu, 3 Sep 2026 15:48:03 +0200 Subject: [PATCH 2/2] modify target pull requets branch for github action branch for testing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Pupier --- .github/workflows/pr-build-main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/pr-build-main.yml b/.github/workflows/pr-build-main.yml index 82e660cfd44db..5195db4f27b2e 100644 --- a/.github/workflows/pr-build-main.yml +++ b/.github/workflows/pr-build-main.yml @@ -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: