Skip to content

Commit c98185d

Browse files
committed
Use semver package to safely compare versions
1 parent 5568c02 commit c98185d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

perl-versions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11

22
const core = require('@actions/core');
33
const github = require('@actions/github');
4+
const semver = require('semver');
45

56
try {
6-
const since_perl = core.getInput('since-perl');
7+
const since_perl = semver.coerce (core.getInput('since-perl'));
78
const with_devel = core.getInput('with-devel') == "true";
89

910
let found = false;
@@ -18,8 +19,7 @@ try {
1819
let filtered = available.filter (
1920
(item) => {
2021
if (item == "devel") { return with_devel; }
21-
if (! found) { found = (item == since_perl); }
22-
return found;
22+
return semver.gte(semver.coerce (item), since_perl);
2323
}
2424
);
2525

0 commit comments

Comments
 (0)