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

Finding versions that satisfy requirements #642

Closed
alandefreitas opened this issue May 10, 2023 · 3 comments
Closed

Finding versions that satisfy requirements #642

alandefreitas opened this issue May 10, 2023 · 3 comments

Comments

@alandefreitas
Copy link

Hi! Thanks for this action. I've been using it a lot lately in https://github.com/alandefreitas/cpp-actions

I have an action there where I check if the system cmake version satisfies the requirements for cmake in a project.
It all works fine. But the problem is when the requirements are not satisfied.

At this point, there's a list of all possible cmake versions and I have to find the one (min or max) that satisfies it.
And this is impossible to achieve directly with github actions and semver-utils as it is because there are no loops in steps.
I couldn't find a solution to that and I think it's an important use case because workflows using this action will definitely handle the case where the requirement is not satisfied.

As a terrible javascript developer, I forked your repo and included a small feature to allow inputs.version to also accept a list of versions instead of just a single version. If you give it a single version the action works just exactly like it does now. It creates extra outputs for the min and max versions. But the whole thing decays to what you have now when you give it a single input version.
The whole change is a few lines of code but it saved my workflow.

So I was wondering if such a thing could be included as a feature here. I believe it's extremely useful, small, and doesn't break anything. Of course, you're a proper JS developer so I would just let you the API, implementation details, and style because you don't want to get it from my code. But the proof of concept is there anyway.

Thanks again,

@madhead
Copy link
Owner

madhead commented May 24, 2023

Hi, @alandefreitas!

Thanks, and excuse me for the late reply.

I've checked the history of your fork (https://github.com/alandefreitas/cpp-actions/commits/develop/semver-utils) and I cannot quite extract the change you've introduces. Can you please point me to a commit SHA? I would consider a cherry pick then.

@alandefreitas
Copy link
Author

alandefreitas commented May 24, 2023

Oh... Yes. I gave you a relative reference at the time. :)

This one is tagged: https://github.com/alandefreitas/cpp-actions/blob/91bda1690ca32f933732c86c602f6fbffe01218f/semver-utils/src/main.ts#L97-L123

Can you please point me to a commit SHA? I would consider a cherry pick then

I don't think there's going to be a commit SHA one you cherry-pick because it's not a fork. I'm using a copy of the project with this small patch just to keep things running. I also wouldn't cherry-pick it because my java/typescript skills are not worth reusing.

In principle, you would have to diff the two files. In practice, I would review the few lines that changed:

https://github.com/alandefreitas/cpp-actions/blob/91bda1690ca32f933732c86c602f6fbffe01218f/semver-utils/src/main.ts#L4-L9
https://github.com/alandefreitas/cpp-actions/blob/91bda1690ca32f933732c86c602f6fbffe01218f/semver-utils/src/main.ts#L97-L134

@madhead
Copy link
Owner

madhead commented Aug 23, 2023

Thanks, but I don't think this should be incorporated into this action. If you have a range of versions maybe you could loop this action with a simple matrix.

@madhead madhead closed this as not planned Won't fix, can't repro, duplicate, stale Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants