Skip to content

Add the concept of to-perl #11

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

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ jobs:
since-perl: 5.36
with-devel: true

since-524-to-532:
runs-on: ubuntu-latest
name: 'since 5.24 to 5.32'
outputs:
perl-versions: ${{ steps.action.outputs.perl-versions }}
steps:
- uses: actions/checkout@v4
- name: "uses perl-versions"
id: action
uses: ./
with:
since-perl: "5.24"
to-perl: "5.32"

test-matrix:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -75,6 +89,7 @@ jobs:
- since-v520
- since-520
- since-536-with-devel
- since-524-to-532
runs-on: ubuntu-latest
steps:

Expand All @@ -89,3 +104,7 @@ jobs:
- name: "Testing since-536-with-devel"
run: |
[[ '${{ needs.since-536-with-devel.outputs.perl-versions }}' == '["5.36","5.38","5.40","5.42","devel"]' ]] && echo "ok"

- name: "Testing since-524-to-532"
run: |
[[ '${{ needs.since-524-to-532.outputs.perl-versions }}' == '["5.24","5.26","5.28","5.30","5.32"]' ]] && echo "ok"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ Returns perl versions since this (including).

When unknown version is provided, returns empty list.

### to-perl

Optional parameter.

When set, returns perl versions up to this version (including this version).
Can be combined with `since-perl` to get a specific range of versions.

When not set, returns all versions from `since-perl` onwards.

### with-devel

Default: `false`
Expand All @@ -37,6 +46,7 @@ jobs:
uses: perl-actions/perl-versions@v1
with:
since-perl: v5.20
to-perl: v5.36
with-devel: false

##
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ inputs:
description: "List all Perl versions since this (including this). Example: 5.10"
type: string
required: true
to-perl:
description: "List all Perl versions up to this (including this). Example: 5.30"
type: string
required: false
with-devel:
description: "Whether to include also 'devel' Perl"
type: boolean
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30267,14 +30267,19 @@ let available = [

try {
const since_perl = semver.coerce(core.getInput('since-perl'));
const to_perl_input = core.getInput('to-perl');
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
const with_devel = core.getInput('with-devel') == "true";

let filtered = available.filter(
(item) => {
if (item == "devel") {
return with_devel;
}
return semver.gte(semver.coerce(item), since_perl);
const version = semver.coerce(item);
const meetsLowerBound = semver.gte(version, since_perl);
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
return meetsLowerBound && meetsUpperBound;
}
);

Expand Down
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,19 @@ let available = [

try {
const since_perl = semver.coerce(core.getInput('since-perl'));
const to_perl_input = core.getInput('to-perl');
const to_perl = to_perl_input ? semver.coerce(to_perl_input) : null;
const with_devel = core.getInput('with-devel') == "true";

let filtered = available.filter(
(item) => {
if (item == "devel") {
return with_devel;
}
return semver.gte(semver.coerce(item), since_perl);
const version = semver.coerce(item);
const meetsLowerBound = semver.gte(version, since_perl);
const meetsUpperBound = !to_perl || semver.lte(version, to_perl);
return meetsLowerBound && meetsUpperBound;
}
);

Expand Down
Loading