-
Notifications
You must be signed in to change notification settings - Fork 7
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
Get Plugin Releases - Prevent unstable releases #102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @puntope for fixing this! I tested locally and it's returning the latest stable version. LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to test this code with the instructions provided, but it wouldn't run with just node get-plugin-releases.js
as it couldn't find the handle-actions and needed some of the input variables in particular slug=woocommerce
to work. Do you have an easy way to get around that?
From testing I also noticed that I had to set both includeRC and includePatches to be able to include a RC version? Can those not be requested individually?
const versions = Object.keys( releases.versions ) | ||
.filter( | ||
( version ) => | ||
version !== 'trunk' && | ||
version !== 'other' && | ||
! version.includes( 'beta' ) | ||
! version.includes( 'beta' ) && | ||
semverCompare( latest, version ) <= 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I understand this will work if we aren't interested in RC versions. But if the stable version is at 8.7.0
and a 8.8.0-rc.1
is available it will now be filtered out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way I do it is to hardcode the inputs directly. As the local env doesn't have the GH libraries. |
I think that's not needed. You can set them individually.
Lets take
result: [ '8.8.0-rc.2', '8.7.0', '8.6.3' ]
result [ '8.7.0', '8.6.3', '8.6.2', '8.6.1' ]
result [ '8.8.0-rc.2', '8.8.0-rc.1', '8.7.0', '8.6.3', '8.6.2', '8.6.1' ] Can you elaborate a bit more about those test cases? |
@mikkamp I updated the code to fix the RC issue. If its good feel free to merge it as I'm AFK next week. I didn't see any issue with the includePatch/includeRC mentioned in #102 (comment). But if so, we can handle it ina. separate issue/pr |
Thanks for the clarification, however I don't seem to be having the same experience, which is because of the following if statement: ( includeRC || ! isRC( version ) ) &&
( includePatches || ! isMinorAlreadyAdded( output, version ) ) It requires both clauses to return a true. But the way the versions are ordered |
const versions = Object.keys( releases.versions ) | ||
.filter( | ||
( version ) => | ||
version !== 'trunk' && | ||
version !== 'other' && | ||
! version.includes( 'beta' ) | ||
! version.includes( 'beta' ) && | ||
( includeRC || semverCompare( latest, version ) <= 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional changes. This now works when we have includeRC set to false it only returns 8.7.0 as the latest version. However if we set includeRC to true it returns both 8.8.0 and 8.8.0-rc.1
I'd be expecting it to return only the 8.8.0-rc.1, should it be using isRC instead of includeRC?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @mikkamp as for this, now I can reproduce the "issue" thanks. However, it's really an issue? The idea of that param is to get RC version for testing the versions before being released. Let's take When |
Hi @mikkamp I fixed the last mentioned bug. Can you take another look? 🙏 This is how I tested it.
In regards the issue with the includeRC/includePatches. See my comments here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the additional fixes. It's now returning the "latest" release candidate when it's available.
In regards to it returning only the "latest" release candidate when includePatches is false, that's fine, but it wasn't clear to me what those were supposed to return. Maybe describing them in the readme would be helpful.
The example "Get L-3 Release versions from WC including RC" is also not super clear how this works. During the times when there is a "latest" release candidate available it will return latest RC, current stable, L-1, L-2
. When there is no release candidate prepared yet it will return current stable, L-1, L-2, L-3
. Maybe clarifying that in the docs will help clear up any confusion in the future.
Changes proposed in this Pull Request:
Closes #101
This PR checks the release versions and ensures the maximum release version is the latest stable one (defined in "version" param under the JSON API .
Screenshots:
Local:
Detailed test instructions:
Verify https://github.com/woocommerce/google-listings-and-ads/actions/runs/8652279994/job/23724824443?pr=2365 is fetching the right versions
npm run build
(notice you might need to remove some GH output/input code)Additional details:
Changelog entry