diff --git a/dist/setup/index.js b/dist/setup/index.js index fa25c0a..486d5de 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -96491,13 +96491,16 @@ function setupPython() { core.info(`Set UV_PYTHON to ${inputs_1.pythonVersion}`); } } +function getVenvPath() { + // Use custom venv path if provided, otherwise default to .venv in working directory + return inputs_1.venvPath ?? path.resolve(`${inputs_1.workingDirectory}${path.sep}.venv`); +} async function activateEnvironment() { if (inputs_1.activateEnvironment) { if (process.env.UV_NO_MODIFY_PATH !== undefined) { throw new Error("UV_NO_MODIFY_PATH and activate-environment cannot be used together."); } - // Use custom venv path if provided, otherwise default to .venv in working directory - const venvPath = inputs_1.venvPath ?? path.resolve(`${inputs_1.workingDirectory}${path.sep}.venv`); + const venvPath = getVenvPath(); core.info(`Activating python venv at ${venvPath}...`); await exec.exec("uv", ["venv", venvPath]); let venvBinPath = `${venvPath}${path.sep}bin`; diff --git a/src/setup-uv.ts b/src/setup-uv.ts index d55c16b..1dd0326 100644 --- a/src/setup-uv.ts +++ b/src/setup-uv.ts @@ -263,6 +263,11 @@ function setupPython(): void { } } +function getVenvPath(): string { + // Use custom venv path if provided, otherwise default to .venv in working directory + return venvPathInput ?? path.resolve(`${workingDirectory}${path.sep}.venv`); +} + async function activateEnvironment(): Promise { if (activateEnvironmentInput) { if (process.env.UV_NO_MODIFY_PATH !== undefined) { @@ -271,9 +276,7 @@ async function activateEnvironment(): Promise { ); } - // Use custom venv path if provided, otherwise default to .venv in working directory - const venvPath = - venvPathInput ?? path.resolve(`${workingDirectory}${path.sep}.venv`); + const venvPath = getVenvPath(); core.info(`Activating python venv at ${venvPath}...`); await exec.exec("uv", ["venv", venvPath]);