Skip to content

Commit

Permalink
🐛 Fix Windows path handling in createVenv function
Browse files Browse the repository at this point in the history
  • Loading branch information
yezz123 committed Nov 12, 2024
1 parent f7a3d06 commit a809eba
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/venv.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import { exec } from '@actions/exec'
import { exportVariable, addPath } from '@actions/core'
import os from 'os'
import path from 'path'

const uvBinPath = path.join(os.homedir(), '.local', 'bin')

export async function createVenv(venv: string) {
if (os.platform() === 'win32') {
await exec('powershell', ['-Command', `$env:Path = "${uvBinPath};$env:Path"`])
}
addPath(uvBinPath)

await exec('uv', ['venv', venv])
}

Expand All @@ -15,4 +23,4 @@ export async function activateVenv(venv: string) {
addPath(`${venv}/bin`)
}
exportVariable('VIRTUAL_ENV', venv)
}
}

0 comments on commit a809eba

Please sign in to comment.