Skip to content

Commit a49f5a8

Browse files
committed
Refactor parsing version input parameter into function
1 parent 56d1b37 commit a49f5a8

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

dist/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30265,10 +30265,14 @@ let available = [
3026530265
"devel",
3026630266
];
3026730267

30268+
function parse_input_version (input_name) {
30269+
// semver.coerce() returns null for both empty string and null inputs
30270+
return semver.coerce (core.getInput (input_name));
30271+
}
30272+
3026830273
try {
30269-
const since_perl = semver.coerce(core.getInput('since-perl'));
30270-
const until_perl_input = core.getInput('until-perl');
30271-
const until_perl = until_perl_input ? semver.coerce(until_perl_input) : null;
30274+
const since_perl = parse_input_version ('since-perl');
30275+
const until_perl = parse_input_version ('until-perl');
3027230276
const with_devel = core.getInput('with-devel') == "true";
3027330277

3027430278
let filtered = available.filter(

index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ let available = [
1010
"devel",
1111
];
1212

13+
function parse_input_version (input_name) {
14+
// semver.coerce() returns null for both empty string and null inputs
15+
return semver.coerce (core.getInput (input_name));
16+
}
17+
1318
try {
14-
const since_perl = semver.coerce(core.getInput('since-perl'));
15-
const until_perl_input = core.getInput('until-perl');
16-
const until_perl = until_perl_input ? semver.coerce(until_perl_input) : null;
19+
const since_perl = parse_input_version ('since-perl');
20+
const until_perl = parse_input_version ('until-perl');
1721
const with_devel = core.getInput('with-devel') == "true";
1822

1923
let filtered = available.filter(

0 commit comments

Comments
 (0)