From 2a5c060ce28fea5df265375fde1fa37b767a310b Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sun, 6 Sep 2020 11:09:41 -0500 Subject: [PATCH] fix: add warning for when arch is supplied but version is missing --- dist/index.js | 5 +++++ src/main.ts | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/dist/index.js b/dist/index.js index 45da787..ee4c75a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -4645,6 +4645,11 @@ function run() { version = core.getInput('version'); } let arch = core.getInput('node-arch'); + // if node-arch supplied but node-version is not + // if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant. + if (arch && !version) { + core.warning('`node-arch` is provided but `node-version` is missing. This results in using an already installed x64 node which is not probably what you meant. To fix this, provide `node-arch` in combination with `node-version`'); + } if (!arch) { arch = os.arch(); } diff --git a/src/main.ts b/src/main.ts index b1a33df..0d3eb77 100644 --- a/src/main.ts +++ b/src/main.ts @@ -17,6 +17,15 @@ export async function run() { } let arch = core.getInput('node-arch'); + + // if node-arch supplied but node-version is not + // if we don't throw a warning, the already installed x64 node will be used which is not probably what user meant. + if (arch && !version) { + core.warning( + '`node-arch` is provided but `node-version` is missing. This results in using an already installed x64 node which is not probably what you meant. To fix this, provide `node-arch` in combination with `node-version`' + ); + } + if (!arch) { arch = os.arch(); }