From 11de413cab72051111cf34da96d123bce561177e Mon Sep 17 00:00:00 2001 From: Auto-revert Test Date: Fri, 21 Aug 2026 18:36:01 +0530 Subject: [PATCH] ci: shallow-fetch release-branch-validate checkouts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each of the three jobs (Java, Python, UI) used fetch-depth: 0, which does a full clone (~500MB, ~16k files, 30-60s wall-clock) just to compute a two-commit diff. Drop to fetch-depth: 2 — enough for the common single-commit cherry-pick case where BEFORE == HEAD~1 — and fetch BEFORE on demand only when a multi-commit push means it's older than the shallow depth carries. Checkout drops to ~2-5s per job. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/release-branch-validate.yml | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-branch-validate.yml b/.github/workflows/release-branch-validate.yml index 2176bb51ff7a..5ed2b6d91377 100644 --- a/.github/workflows/release-branch-validate.yml +++ b/.github/workflows/release-branch-validate.yml @@ -46,10 +46,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 20 steps: - - name: Checkout with history + - name: Checkout with parent uses: actions/checkout@v7 with: - fetch-depth: 0 + # Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the + # older base on demand in the "Determine changed X files" step. + fetch-depth: 2 persist-credentials: false - name: Determine changed Java files @@ -61,6 +63,9 @@ jobs: if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then BASE=$(git rev-parse HEAD~1) else + # Multi-commit push: BEFORE may be older than the shallow depth 2 + # checkout carries, so pull just that one object on demand. + git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}" BASE="${BEFORE}" fi CHANGED=$(git diff --name-only --diff-filter=ACMR "${BASE}" HEAD -- '*.java' | tr '\n' ' ') @@ -115,10 +120,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 10 steps: - - name: Checkout with history + - name: Checkout with parent uses: actions/checkout@v7 with: - fetch-depth: 0 + # Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the + # older base on demand in the "Determine changed X files" step. + fetch-depth: 2 persist-credentials: false - name: Determine changed Python files @@ -130,6 +137,9 @@ jobs: if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then BASE=$(git rev-parse HEAD~1) else + # Multi-commit push: BEFORE may be older than the shallow depth 2 + # checkout carries, so pull just that one object on demand. + git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}" BASE="${BEFORE}" fi # Scope to the two dirs ingestion/Makefile:py_format_check targets. @@ -176,10 +186,12 @@ jobs: env: UI_WORKING_DIRECTORY: openmetadata-ui/src/main/resources/ui steps: - - name: Checkout with history + - name: Checkout with parent uses: actions/checkout@v7 with: - fetch-depth: 0 + # Shallow: just HEAD and HEAD~1. Multi-commit pushes fetch the + # older base on demand in the "Determine changed X files" step. + fetch-depth: 2 persist-credentials: false - name: Determine changed UI files @@ -191,6 +203,9 @@ jobs: if [ -z "${BEFORE}" ] || [ "${BEFORE}" = "0000000000000000000000000000000000000000" ]; then BASE=$(git rev-parse HEAD~1) else + # Multi-commit push: BEFORE may be older than the shallow depth 2 + # checkout carries, so pull just that one object on demand. + git cat-file -e "${BEFORE}" 2>/dev/null || git fetch --depth=1 origin "${BEFORE}" BASE="${BEFORE}" fi # Match existing ui-checkstyle: src globs only, exclude generated/**.