Skip to content

Commit

Permalink
Handle missing booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Jul 14, 2023
1 parent 3b8222b commit 3f27154
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
9 changes: 8 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13667,14 +13667,21 @@ 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'),
stackVersion: core.getInput('stack-version'),
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')
Expand Down
10 changes: 9 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ 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'),
stackVersion: core.getInput('stack-version'),
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')
Expand Down

0 comments on commit 3f27154

Please sign in to comment.