From bf0db24fb0a965023f9b9358c8d57c20841094a9 Mon Sep 17 00:00:00 2001 From: Seungpyo1007 Date: Wed, 30 Sep 2026 16:19:43 +0900 Subject: [PATCH] ci(pr-validation): shallow checkouts and scoped app.validate The PR validation comment cloned TechAPI's full history twice (head and base) and ran app.validate over every record. Check both out at depth 1, deepen the head only to the merge base, fetch the pinned base at depth 1, and validate just the changed records. integrity_check still scans both trees; it is population-based and needs its own scoping. Refs GetTechAPI/TechAPI#350 --- .github/workflows/techapi-pr-validation-comment.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/techapi-pr-validation-comment.yml b/.github/workflows/techapi-pr-validation-comment.yml index f9f4a6e..887679f 100644 --- a/.github/workflows/techapi-pr-validation-comment.yml +++ b/.github/workflows/techapi-pr-validation-comment.yml @@ -73,7 +73,8 @@ jobs: repository: GetTechAPI/TechAPI ref: ${{ env.TECHAPI_HEAD_SHA }} path: TechAPI - fetch-depth: 0 + # Shallow; deepened to the merge base in the next-but-one step. + fetch-depth: 1 - name: Checkout TechAPI PR base uses: actions/checkout@v4 @@ -81,14 +82,16 @@ jobs: repository: GetTechAPI/TechAPI ref: ${{ env.TECHAPI_BASE_SHA }} path: TechAPI-base - fetch-depth: 0 + fetch-depth: 1 - name: Pin PR base to the merge base shell: bash run: | - git -C TechAPI fetch --no-tags origin "$TECHAPI_BASE_SHA" + git -C TechAPI fetch --no-tags --depth=100 origin "$TECHAPI_BASE_SHA" + # Fall back to full history only if the PR branched from far back. + git -C TechAPI merge-base "$TECHAPI_BASE_SHA" HEAD >/dev/null 2>&1 || git -C TechAPI fetch --no-tags --unshallow origin base_sha="$(git -C TechAPI merge-base "$TECHAPI_BASE_SHA" HEAD)" - git -C TechAPI-base fetch --no-tags origin "$base_sha" + git -C TechAPI-base fetch --no-tags --depth=1 origin "$base_sha" git -C TechAPI-base checkout --detach "$base_sha" echo "TECHAPI_DIFF_BASE=$base_sha" >> "$GITHUB_ENV" @@ -161,7 +164,7 @@ jobs: set +e { echo "## app.validate" - python -m app.validate + python -m app.validate --changed-since "$TECHAPI_DIFF_BASE" echo "app_validate_status=$?" } > validation.log 2>&1 app_status=$(grep "app_validate_status=" validation.log | tail -n 1 | cut -d= -f2)