From 3f2715436c49e3e1c7b19450d595348512bbe8eb Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Thu, 13 Jul 2023 20:42:11 -0700 Subject: [PATCH] Handle missing booleans --- dist/index.js | 9 ++++++++- src/main.ts | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index fb024eb..fbb83c3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13667,6 +13667,13 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); const core = __importStar(__nccwpck_require__(2186)); const setup_haskell_1 = __importDefault(__nccwpck_require__(9351)); const getToggleInput = (name) => core.getInput(name) !== ''; +const getBooleanInput = (name) => { + // https://github.com/actions/toolkit/issues/844 + if (!process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`]) { + return undefined; + } + return core.getBooleanInput(name); +}; (0, setup_haskell_1.default)({ ghcVersion: core.getInput('ghc-version'), cabalVersion: core.getInput('cabal-version'), @@ -13674,7 +13681,7 @@ const getToggleInput = (name) => core.getInput(name) !== ''; enableStack: getToggleInput('enable-stack'), stackNoGlobal: getToggleInput('stack-no-global'), stackSetupGhc: getToggleInput('stack-setup-ghc'), - cabalUpdate: core.getBooleanInput('cabal-update'), + cabalUpdate: getBooleanInput('cabal-update'), ghcupReleaseChannels: core.getMultilineInput('ghcup-release-channels'), ghcupReleaseChannel: core.getInput('ghcup-release-channel'), disableMatcher: getToggleInput('disable-matcher') diff --git a/src/main.ts b/src/main.ts index 66b23c0..16a9b56 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,6 +3,14 @@ import run from './setup-haskell'; const getToggleInput = (name: string) => core.getInput(name) !== ''; +const getBooleanInput = (name: string): boolean | undefined => { + // https://github.com/actions/toolkit/issues/844 + if (!process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`]) { + return undefined; + } + return core.getBooleanInput(name); +}; + run({ ghcVersion: core.getInput('ghc-version'), cabalVersion: core.getInput('cabal-version'), @@ -10,7 +18,7 @@ run({ enableStack: getToggleInput('enable-stack'), stackNoGlobal: getToggleInput('stack-no-global'), stackSetupGhc: getToggleInput('stack-setup-ghc'), - cabalUpdate: core.getBooleanInput('cabal-update'), + cabalUpdate: getBooleanInput('cabal-update'), ghcupReleaseChannels: core.getMultilineInput('ghcup-release-channels'), ghcupReleaseChannel: core.getInput('ghcup-release-channel'), disableMatcher: getToggleInput('disable-matcher')