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

Fixed regex for matching versions #253

Merged
merged 2 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion dist/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/post.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export const getOptions = () => {
),
micromambaVersion: parseOrUndefined(
'micromamba-version',
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
Copy link
Member

Choose a reason for hiding this comment

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

To match PEP440 version numbers of release candidates, alphas, and betas (for instance 2.0.0rc0):

Suggested change
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d+)?-\d+$/)]),

Copy link
Member Author

@JohanMabille JohanMabille Dec 10, 2024

Choose a reason for hiding this comment

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

This does not work. I think it's rather ^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$ (yes, I let you find the single character I had to change :D)

My bad, I entered wrong matches.

Copy link
Member

Choose a reason for hiding this comment

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

Let's go. :)

Suggested change
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.(?:rc|alpha|beta)\d+)?-\d+$/)]),
z.union([z.literal('latest'), z.string().regex(/^\d+\.\d+\.\d+(?:\.?(?:rc|alpha|beta)\d*)?-\d+$/)]),

Copy link
Member

Choose a reason for hiding this comment

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

Should we add dev as well since it was added here?

'micromamba-version must be either `latest` or a version matching `1.2.3-0`.'
),
micromambaUrl: parseOrUndefined('micromamba-url', z.string().url()),
Expand Down
Loading