From 008bf69458cfa7244aa7d986c71df132ae68e179 Mon Sep 17 00:00:00 2001 From: JamesIves Date: Sat, 28 Mar 2020 13:04:59 -0400 Subject: [PATCH] Correctly checks if values are true --- src/constants.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index 1fd6acb3..3a7970b9 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,7 @@ export interface ActionInterface { /** The branch that the action should deploy to. */ branch: string /** If your project generates hashed files on build you can use this option to automatically delete them from the deployment branch with each deploy. This option can be toggled on by setting it to true. */ - clean?: string | boolean + clean?: boolean /** If you need to use CLEAN but you'd like to preserve certain files or folders you can use this option. */ cleanExclude?: string | string[] /** If you need to customize the commit message for an integration you can do so. */ @@ -27,7 +27,7 @@ export interface ActionInterface { /** GitHub deployment token. */ gitHubToken?: string | null /** Determines if the action is running in test mode or not. */ - isTest?: string | undefined | null + isTest?: boolean /** The git config name. */ name?: string /** The repository path, for example JamesIves/github-pages-deploy-action. */ @@ -37,7 +37,7 @@ export interface ActionInterface { /** The root directory where your project lives. */ root?: string /** Set to true if you're using an ssh client in your build step. */ - ssh?: string | boolean | null + ssh?: boolean /** If you'd like to push the contents of the deployment folder into a specific directory on the deployment branch you can specify it here. */ targetFolder?: string /** The token type, ie ssh/github token/access token, this gets automatically generated. */ @@ -53,11 +53,17 @@ export const action: ActionInterface = { folder: getInput('FOLDER'), branch: getInput('BRANCH'), commitMessage: getInput('COMMIT_MESSAGE'), - clean: getInput('CLEAN'), + clean: !isNullOrUndefined(getInput('CLEAN')) + ? getInput('CLEAN').toLowerCase() === 'true' + : false, cleanExclude: getInput('CLEAN_EXCLUDE'), defaultBranch: process.env.GITHUB_SHA ? process.env.GITHUB_SHA : 'master', - isTest: process.env.UNIT_TEST, - ssh: getInput('SSH'), + isTest: process.env.UNIT_TEST + ? process.env.UNIT_TEST.toLowerCase() === 'true' + : false, + ssh: !isNullOrUndefined(getInput('SSH')) + ? getInput('SSH').toLowerCase() === 'true' + : false, email: !isNullOrUndefined(getInput('GIT_CONFIG_EMAIL')) ? getInput('GIT_CONFIG_EMAIL') : pusher && pusher.email