diff --git a/dist/index.js b/dist/index.js index c315d06..1ab06d7 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/src/install-pnpm/index.ts b/src/install-pnpm/index.ts index 23b2695..ac74224 100644 --- a/src/install-pnpm/index.ts +++ b/src/install-pnpm/index.ts @@ -1,16 +1,27 @@ -import { setFailed, startGroup, endGroup } from '@actions/core' -import { Inputs } from '../inputs' -import runSelfInstaller from './run' +import { setFailed, startGroup, endGroup } from "@actions/core"; +import { Inputs } from "../inputs"; +import runSelfInstaller from "./run"; +import { exec } from "child_process"; +import { promisify } from "util"; -export { runSelfInstaller } +export { runSelfInstaller }; +const execAsync = promisify(exec); export async function install(inputs: Inputs) { - startGroup('Running self-installer...') - const status = await runSelfInstaller(inputs) - endGroup() + try { + await execAsync("pnpm --version"); + return; + } catch {} + + startGroup("Running self-installer..."); + const status = await runSelfInstaller(inputs); + endGroup(); + if (status) { - return setFailed(`Something went wrong, self-installer exits with code ${status}`) + return setFailed( + `Something went wrong, self-installer exits with code ${status}`, + ); } } -export default install +export default install;