Skip to content

Commit 8b39fa2

Browse files
authored
refactor(get-inputs): add isBoolean (#731)
1 parent 1226087 commit 8b39fa2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/get-inputs.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ export function showInputs(inps: Inputs): void {
3535
export function getInputs(): Inputs {
3636
let useBuiltinJekyll = false;
3737

38-
const enableJekyll: boolean =
39-
(core.getInput('enable_jekyll') || 'false').toUpperCase() === 'TRUE';
40-
const disableNoJekyll: boolean =
41-
(core.getInput('disable_nojekyll') || 'false').toUpperCase() === 'TRUE';
38+
const isBoolean = (param: string): boolean => (param || 'false').toUpperCase() === 'TRUE';
39+
40+
const enableJekyll: boolean = isBoolean(core.getInput('enable_jekyll'));
41+
const disableNoJekyll: boolean = isBoolean(core.getInput('disable_nojekyll'));
4242

4343
if (enableJekyll && disableNoJekyll) {
4444
throw new Error(`Use either of enable_jekyll or disable_nojekyll`);
@@ -56,9 +56,9 @@ export function getInputs(): Inputs {
5656
PublishDir: core.getInput('publish_dir'),
5757
DestinationDir: core.getInput('destination_dir'),
5858
ExternalRepository: core.getInput('external_repository'),
59-
AllowEmptyCommit: (core.getInput('allow_empty_commit') || 'false').toUpperCase() === 'TRUE',
60-
KeepFiles: (core.getInput('keep_files') || 'false').toUpperCase() === 'TRUE',
61-
ForceOrphan: (core.getInput('force_orphan') || 'false').toUpperCase() === 'TRUE',
59+
AllowEmptyCommit: isBoolean(core.getInput('allow_empty_commit')),
60+
KeepFiles: isBoolean(core.getInput('keep_files')),
61+
ForceOrphan: isBoolean(core.getInput('force_orphan')),
6262
UserName: core.getInput('user_name'),
6363
UserEmail: core.getInput('user_email'),
6464
CommitMessage: core.getInput('commit_message'),

0 commit comments

Comments
 (0)