-
Notifications
You must be signed in to change notification settings - Fork 375
Fix parsing of GHES pre-release versions #2969
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1132,6 +1132,23 @@ export function checkActionVersion( | |||||
} | ||||||
} | ||||||
|
||||||
/** | ||||||
* This will parse a GitHub Enterprise Server version string into a SemVer object. | ||||||
* | ||||||
* GHES versions are usually in a semver-compatible format, so usually this will | ||||||
* just call the SemVer constructor. However, for GHES pre-release versions, | ||||||
* the version string is in the format "3.18.0.pre1", which is not a valid semver | ||||||
* version since the pre-release part of the version should be separated by a | ||||||
* hyphen. This function will replace the ".pre" part of the version with "-pre" | ||||||
* to make it a valid semver version. | ||||||
*/ | ||||||
export function parseGhesVersion(version: string): semver.SemVer { | ||||||
if (version.includes(".pre")) { | ||||||
version = version.replace(".pre", "-pre"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||||||
} | ||||||
return new semver.SemVer(version); | ||||||
} | ||||||
|
||||||
/** | ||||||
* Supported build modes. | ||||||
* | ||||||
|
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 condition
version.includes(".pre")
may be too broad and could match unintended patterns. Consider using a more specific pattern like/\.pre\d+$/
to ensure it only matches the expected GHES pre-release format at the end of the version string.Copilot uses AI. Check for mistakes.