feat: add venv-path input for activate-environment (#746)

Allow customizing the venv location while preserving working-directory
semantics via --directory.

Supersedes: #736
This commit is contained in:
Kevin Stillhammer
2026-02-04 08:40:32 +01:00
committed by GitHub
parent 99b0f0474b
commit 3511ff7054
10 changed files with 229 additions and 15 deletions

View File

@@ -24,6 +24,7 @@ import {
resolutionStrategy,
toolBinDir,
toolDir,
venvPath,
versionFile as versionFileInput,
version as versionInput,
workingDirectory,
@@ -269,12 +270,10 @@ async function activateEnvironment(): Promise<void> {
"UV_NO_MODIFY_PATH and activate-environment cannot be used together.",
);
}
const execArgs = ["venv", ".venv", "--directory", workingDirectory];
core.info("Activating python venv...");
await exec.exec("uv", execArgs);
core.info(`Creating and activating python venv at ${venvPath}...`);
await exec.exec("uv", ["venv", venvPath, "--directory", workingDirectory]);
const venvPath = path.resolve(`${workingDirectory}${path.sep}.venv`);
let venvBinPath = `${venvPath}${path.sep}bin`;
if (process.platform === "win32") {
venvBinPath = `${venvPath}${path.sep}Scripts`;