From 6ce9e74e3bb44803c4dd18ec01def37e80e434e7 Mon Sep 17 00:00:00 2001 From: Rares Matei Date: Tue, 17 Dec 2024 12:13:02 +0000 Subject: [PATCH] use protocol v2 for checking out repo (#78) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Miroslav Jonaš --- workflow-steps/checkout/main.ts | 3 ++- workflow-steps/checkout/output/main.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/workflow-steps/checkout/main.ts b/workflow-steps/checkout/main.ts index 4378c6a..dacb75f 100644 --- a/workflow-steps/checkout/main.ts +++ b/workflow-steps/checkout/main.ts @@ -11,11 +11,12 @@ if (process.platform != 'win32') { } execSync('git init .'); execSync(`git remote add origin ${repoUrl}`); +execSync(`echo "GIT_REPOSITORY_URL=''" >> $NX_CLOUD_ENV`); if (depth === '0') { // Fetch all branches and tags if depth is 0 execSync( - 'git fetch --prune --progress --no-recurse-submodules --tags origin "+refs/heads/*:refs/remotes/origin/*"', + 'git fetch -c protocol.version=2 --prune --progress --no-recurse-submodules --tags origin "+refs/heads/*:refs/remotes/origin/*"', ); } else { // Fetch with specified depth diff --git a/workflow-steps/checkout/output/main.js b/workflow-steps/checkout/output/main.js index fda6540..3fca4d8 100644 --- a/workflow-steps/checkout/output/main.js +++ b/workflow-steps/checkout/output/main.js @@ -10,9 +10,10 @@ if (process.platform != "win32") { } (0, import_child_process.execSync)("git init ."); (0, import_child_process.execSync)(`git remote add origin ${repoUrl}`); +(0, import_child_process.execSync)(`echo "GIT_REPOSITORY_URL=''" >> $NX_CLOUD_ENV`); if (depth === "0") { (0, import_child_process.execSync)( - 'git fetch --prune --progress --no-recurse-submodules --tags origin "+refs/heads/*:refs/remotes/origin/*"' + 'git fetch -c protocol.version=2 --prune --progress --no-recurse-submodules --tags origin "+refs/heads/*:refs/remotes/origin/*"' ); } else { const tagsArg = fetchTags ? " --tags" : "--no-tags";