diff --git a/lib/main.js b/lib/main.js index ce03844..25eb905 100644 --- a/lib/main.js +++ b/lib/main.js @@ -58,7 +58,7 @@ function run() { process.chdir(tmpdir); const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, { encoding: 'utf8' }).trim().length > 0; - if (remote_branch_exists) { + if (keep_history && remote_branch_exists) { yield exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']); } else { diff --git a/src/main.ts b/src/main.ts index f860718..f065b0a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -43,7 +43,7 @@ async function run() { const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length > 0; - if (remote_branch_exists) { + if (keep_history && remote_branch_exists) { await exec.exec('git', ['clone', '--quiet', '--branch', target_branch, '--depth', '1', remote_url, '.']); } else { core.info(`🏃 Initializing local git repo`);