From 25d2116380f8cba84e95050069a07a9623c9ba0e Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Fri, 26 Sep 2025 20:28:05 +0000 Subject: [PATCH] fix(codegen): git fetch smithy-ts only when necessary --- scripts/generate-clients/build-smithy-typescript.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/generate-clients/build-smithy-typescript.js b/scripts/generate-clients/build-smithy-typescript.js index d21fb62edcb1..d52274596c04 100644 --- a/scripts/generate-clients/build-smithy-typescript.js +++ b/scripts/generate-clients/build-smithy-typescript.js @@ -13,8 +13,12 @@ const buildSmithyTypeScript = async (repo, commit) => { await spawnProcess("git", ["clone", "https://github.com/awslabs/smithy-typescript.git", repo, "--depth=1"]); } - // Checkout commit - await spawnProcess("git", ["fetch", "origin", commit, "--depth=1"], { cwd: repo }); + // Checkout commit (connect to remote only when necessary) + try { + await spawnProcess("git", ["cat-file", "-e", commit], { cwd: repo }); + } catch (error) { + await spawnProcess("git", ["fetch", "origin", commit, "--depth=1"], { cwd: repo }); + } // Switch to branch with commit const tempBranchName = `temp-${commit}`;