Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prep before publishing action #3

Merged
merged 18 commits into from
Apr 27, 2024
43 changes: 22 additions & 21 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@

const core = require('@actions/core');
const core = require('@actions/core');
//const github = require('@actions/github');
const semver = require('semver');

try {
const since_perl = semver.coerce (core.getInput('since-perl'));
const with_devel = core.getInput('with-devel') == "true";
const since_perl = semver.coerce(core.getInput('since-perl'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please retain indent with tabs. That is something I call "contributor friendly", allowing everyone to set their own tab width to whatever they want, letting tab representing "1 indent level"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added pretty and this is auto converted by npm run pretty

const with_devel = core.getInput('with-devel') == "true";

let available = [
"5.8",
"5.10", "5.12", "5.14", "5.16", "5.18",
"5.20", "5.22", "5.24", "5.26", "5.28",
"5.30", "5.32", "5.34", "5.36", "5.38",
"devel",
];
let available = [
"5.8",
"5.10", "5.12", "5.14", "5.16", "5.18",
"5.20", "5.22", "5.24", "5.26", "5.28",
"5.30", "5.32", "5.34", "5.36", "5.38",
"devel",
];

let filtered = available.filter (
(item) => {
if (item == "devel") { return with_devel; }
return semver.gte(semver.coerce(item), semver.coerce(since_perl));
}
);
let filtered = available.filter(
(item) => {
if (item == "devel") {
return with_devel;
}
return semver.gte(semver.coerce(item), semver.coerce(since_perl));
}
);

console.log('perl-versions', JSON.stringify(filtered));
core.setOutput('perl-versions', JSON.stringify(filtered));
console.log('perl-versions', JSON.stringify(filtered));
core.setOutput('perl-versions', JSON.stringify(filtered));
} catch (error) {
core.setFailed(error.message);
}
core.setFailed(error.message);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please also configure tooling to enforce trailing newline

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same this is coming from pretty I'm sure this is configurable, not sure how, feel free to adjust