mirror of https://github.com/aminya/setup-cpp
perf: cache checking choco installation
This commit is contained in:
parent
edd8e55e9a
commit
064da1045c
|
@ -1,11 +1,15 @@
|
||||||
|
/* eslint-disable require-atomic-updates */
|
||||||
import { exec } from "@actions/exec"
|
import { exec } from "@actions/exec"
|
||||||
import which from "which"
|
import which from "which"
|
||||||
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
import { setupChocolatey } from "../../chocolatey/chocolatey"
|
||||||
|
|
||||||
|
let hasChoco = false
|
||||||
|
|
||||||
/** A function that installs a package using choco */
|
/** A function that installs a package using choco */
|
||||||
export async function setupChocoPack(name: string, version?: string) {
|
export async function setupChocoPack(name: string, version?: string) {
|
||||||
if (which.sync("choco", { nothrow: true }) === null) {
|
if (!hasChoco || which.sync("choco", { nothrow: true }) === null) {
|
||||||
await setupChocolatey()
|
await setupChocolatey()
|
||||||
|
hasChoco = true
|
||||||
}
|
}
|
||||||
|
|
||||||
let exit
|
let exit
|
||||||
|
|
Loading…
Reference in New Issue