Skip to content

Commit

Permalink
refactor: adopt tests 4
Browse files Browse the repository at this point in the history
  • Loading branch information
BioPhoton committed Jul 21, 2023
1 parent 187f420 commit 6711abb
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/user-flow-gh-action/src/app/get-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ export function getInputs(): GhActionInputs {

// GLOBAL PARAMS =================================================

let onlyCommentsInput = core.getInput('onlyComments', { trimWhitespace: true });
if (onlyCommentsInput === '') {
onlyCommentsInput = 'off';
}
if (onlyCommentsInput !== 'on' && onlyCommentsInput !== 'off') {
throw new Error(wrongDryRunValue(onlyCommentsInput));
}
// convert action input to boolean
const onlyComments = onlyCommentsInput === 'on';
core.debug(`Input onlyComments is ${onlyComments}`);

// Inspect user-flowrc file for malformations
const rcPath: string | null = core.getInput('rcPath') ? resolve(core.getInput('rcPath')) : null;
core.debug(`Input rcPath is ${rcPath}`);
Expand Down Expand Up @@ -91,16 +102,6 @@ export function getInputs(): GhActionInputs {
dryRun
};

// global
const onlyCommentsInput = core.getInput('onlyComments', { trimWhitespace: true });
if (onlyCommentsInput !== 'on' && onlyCommentsInput !== 'off') {
throw new Error(wrongVerboseValue(onlyCommentsInput));
}
core.debug(`Input onlyComments is ${onlyCommentsInput}`);

// convert action input to boolean
ghI.onlyComments = onlyCommentsInput === 'on';

// collect
core.debug(`Input url is ${url}`);
url && (ghI.url = url);
Expand Down

0 comments on commit 6711abb

Please sign in to comment.