diff --git a/src/conan/conan.ts b/src/conan/conan.ts index 03e8ffda..1c14af45 100644 --- a/src/conan/conan.ts +++ b/src/conan/conan.ts @@ -1,15 +1,5 @@ import { setupPip } from "../utils/setup/setupPip" -import { addPath, startGroup, endGroup } from "@actions/core" export async function setupConan(version?: string) { await setupPip("conan", version) - - if (process.platform === "linux") { - try { - startGroup(`Add /home/runner/.local/bin to PATH`) - addPath("/home/runner/.local/bin/") - } finally { - endGroup() - } - } } diff --git a/src/gcovr/gcovr.ts b/src/gcovr/gcovr.ts index 06d27eda..c6f6c240 100644 --- a/src/gcovr/gcovr.ts +++ b/src/gcovr/gcovr.ts @@ -1,15 +1,5 @@ import { setupPip } from "../utils/setup/setupPip" -import { addPath, startGroup, endGroup } from "@actions/core" export async function setupGcovr(version?: string) { await setupPip("gcovr", version) - - if (process.platform === "linux") { - try { - startGroup(`Add /home/runner/.local/bin to PATH`) - addPath("/home/runner/.local/bin/") - } finally { - endGroup() - } - } } diff --git a/src/meson/meson.ts b/src/meson/meson.ts index d4eda9d7..41db0272 100644 --- a/src/meson/meson.ts +++ b/src/meson/meson.ts @@ -1,15 +1,5 @@ import { setupPip } from "../utils/setup/setupPip" -import { addPath, startGroup, endGroup } from "@actions/core" export async function setupMeson(version?: string) { await setupPip("meson", version) - - if (process.platform === "linux") { - try { - startGroup(`Add /home/runner/.local/bin to PATH`) - addPath("/home/runner/.local/bin/") - } finally { - endGroup() - } - } } diff --git a/src/utils/setup/setupPip.ts b/src/utils/setup/setupPip.ts index 19197baf..784cec27 100644 --- a/src/utils/setup/setupPip.ts +++ b/src/utils/setup/setupPip.ts @@ -1,5 +1,6 @@ import { exec } from "@actions/exec" import which from "which" +import { addPath, startGroup, endGroup } from "@actions/core" /** A function that installs a package using pip */ export async function setupPip(name: string, version?: string) { @@ -10,4 +11,13 @@ export async function setupPip(name: string, version?: string) { if (exit !== 0) { throw new Error(`Failed to install ${name} ${version}`) } + + if (process.platform === "linux") { + try { + startGroup(`Add /home/runner/.local/bin to PATH`) + addPath("/home/runner/.local/bin/") + } finally { + endGroup() + } + } }