|
1 | 1 | import * as core from '@actions/core'; |
| 2 | +import { exec, ExecOptions } from '@actions/exec'; |
2 | 3 | import * as hc from '@actions/http-client'; |
3 | | -import * as tc from '@actions/tool-cache'; |
4 | 4 | import * as io from '@actions/io'; |
5 | | -import { exec, ExecOptions } from '@actions/exec'; |
| 5 | +import * as tc from '@actions/tool-cache'; |
| 6 | +import * as fs from 'fs'; |
6 | 7 | import type { OutgoingHttpHeaders } from 'http'; |
7 | 8 | import * as os from 'os'; |
8 | 9 | import * as path from 'path'; |
9 | 10 | import * as semver from 'semver'; |
10 | | -import * as fs from 'fs'; |
11 | 11 | import { v4 as uuidV4 } from 'uuid'; |
12 | 12 |
|
13 | 13 | type VoltaInstallOptions = { |
@@ -242,7 +242,8 @@ async function acquireVolta(version: string, options: VoltaInstallOptions): Prom |
242 | 242 |
|
243 | 243 | async function setupVolta(version: string, voltaHome: string): Promise<void> { |
244 | 244 | if (voltaVersionHasSetup(version)) { |
245 | | - await exec(path.join(voltaHome, 'bin', 'volta'), ['setup'], { |
| 245 | + const executable = path.join(voltaHome, 'bin', 'volta'); |
| 246 | + await exec(executable, ['setup'], { |
246 | 247 | env: { |
247 | 248 | // VOLTA_HOME needs to be set before calling volta setup |
248 | 249 | VOLTA_HOME: voltaHome, |
@@ -331,12 +332,12 @@ export async function getVolta(options: VoltaInstallOptions): Promise<void> { |
331 | 332 | // download, extract, cache |
332 | 333 | const toolRoot = await acquireVolta(version, options); |
333 | 334 |
|
334 | | - await setupVolta(version, toolRoot); |
335 | | - |
336 | 335 | // Install into the local tool cache - node extracts with a root folder |
337 | 336 | // that matches the fileName downloaded |
338 | 337 | voltaHome = await tc.cacheDir(toolRoot, 'volta', version); |
339 | 338 |
|
| 339 | + await setupVolta(version, voltaHome); |
| 340 | + |
340 | 341 | core.info(`caching volta@${version} into ${voltaHome}`); |
341 | 342 | } else { |
342 | 343 | core.info(`using cached volta@${version}`); |
|
0 commit comments