From 649aac71b940ba6a812420d50066fa87281b22a4 Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Wed, 15 Sep 2021 00:37:37 -0500 Subject: [PATCH] fix: skip choco installation on non-windows --- .../__tests__/{conan.test.ts => chocolatey.test.ts} | 3 +++ src/chocolatey/chocolatey.ts | 4 ++++ 2 files changed, 7 insertions(+) rename src/chocolatey/__tests__/{conan.test.ts => chocolatey.test.ts} (85%) diff --git a/src/chocolatey/__tests__/conan.test.ts b/src/chocolatey/__tests__/chocolatey.test.ts similarity index 85% rename from src/chocolatey/__tests__/conan.test.ts rename to src/chocolatey/__tests__/chocolatey.test.ts index e52516be..b6ba4329 100644 --- a/src/chocolatey/__tests__/conan.test.ts +++ b/src/chocolatey/__tests__/chocolatey.test.ts @@ -5,6 +5,9 @@ jest.setTimeout(100000) describe("setup-chocolatey", () => { it("should setup chocolatey", async () => { + if (process.platform !== "win32") { + return + } await setupChocolatey() const { status } = spawn("choco", ["--version"], { diff --git a/src/chocolatey/chocolatey.ts b/src/chocolatey/chocolatey.ts index 5da8ef88..5f82b707 100644 --- a/src/chocolatey/chocolatey.ts +++ b/src/chocolatey/chocolatey.ts @@ -2,6 +2,10 @@ import { exec } from "@actions/exec" import which from "which" export async function setupChocolatey() { + if (process.platform !== "win32") { + return + } + if (which.sync("choco", { nothrow: true }) !== null) { return }