diff --git a/.github/workflows/pr-build-main.yml b/.github/workflows/pr-build-main.yml index e066df2a41ffe..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: @@ -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 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 +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 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