-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(mise): add support for github backend #40706
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
base: main
Are you sure you want to change the base?
Conversation
viceice
left a comment
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.
otherwise LGTM
| } | ||
| } else if (!hasVPrefix) { | ||
| // Default: strip 'v' prefix if current version doesn't have it | ||
| extractVersion = '^v?(?<version>.+)'; |
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 don't like that, it causes performance loose when it's not needed. it should be configured explicit if needed. 🤔
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.
This was inspired by the ubi backend. The aqua backend seems to always use extractVersion. Could you expand a bit on what your preferred solution might look like?
| }); | ||
| }); | ||
|
|
||
| it('should set extractVersion if the version does not have leading v', () => { |
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.
Isn't this already covered in the previous test?
lib/modules/manager/mise/backends.ts
Outdated
| if (isString(toolOptions.version_prefix)) { | ||
| const prefix = toolOptions.version_prefix; | ||
| if (prefix === '') { | ||
| // Empty prefix - no extractVersion needed if version has 'v' |
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.
| // Empty prefix - no extractVersion needed if version has 'v' | |
| // Empty prefix - no extractVersion needed if version starts with 'v' |
lib/modules/manager/mise/backends.ts
Outdated
| if (isString(toolOptions.version_prefix)) { | ||
| const prefix = toolOptions.version_prefix; | ||
| if (prefix === '') { | ||
| // Empty prefix - no extractVersion needed if version has 'v' | ||
| if (!hasVPrefix) { | ||
| extractVersion = '^(?<version>.+)'; | ||
| } | ||
| } else { | ||
| // Custom prefix - escape special regex chars | ||
| const escapedPrefix = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | ||
| extractVersion = `^${escapedPrefix}(?<version>.+)`; | ||
| } | ||
| } else if (!hasVPrefix) { | ||
| // Default: strip 'v' prefix if current version doesn't have it | ||
| extractVersion = '^v?(?<version>.+)'; | ||
| } |
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.
Less nested ifs
| if (isString(toolOptions.version_prefix)) { | |
| const prefix = toolOptions.version_prefix; | |
| if (prefix === '') { | |
| // Empty prefix - no extractVersion needed if version has 'v' | |
| if (!hasVPrefix) { | |
| extractVersion = '^(?<version>.+)'; | |
| } | |
| } else { | |
| // Custom prefix - escape special regex chars | |
| const escapedPrefix = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
| extractVersion = `^${escapedPrefix}(?<version>.+)`; | |
| } | |
| } else if (!hasVPrefix) { | |
| // Default: strip 'v' prefix if current version doesn't have it | |
| extractVersion = '^v?(?<version>.+)'; | |
| } | |
| if (isNonEmptyString(prefix)) { | |
| // Custom prefix - escape special regex chars | |
| const escapedPrefix = prefix.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); | |
| extractVersion = `^${escapedPrefix}(?<version>.+)`; | |
| } | |
| // Empty prefix - no extractVersion needed if version has 'v' | |
| if (isEmptyString(prefix) && !hasVPrefix) { | |
| extractVersion = '^(?<version>.+)'; | |
| } | |
| if (!hasVPrefix) { | |
| // Default: strip 'v' prefix if current version doesn't have it | |
| extractVersion = '^v?(?<version>.+)'; | |
| } | |
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.
Although this seems a bit more performance intensive, I modified it. I did need to switch to else if to prevent the last if from overwriting extractVersion if it was set earlier. I could have an explicit check instead though if you prefer that.
RahulGautamSingh
left a comment
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.
LGTM
|
Do you want me to rebase and force push? I see there is now a conflict. |
196e80f to
f91ed55
Compare
|
I rebased this. Please let me know if there is anything else that needs to be changed. |
Changes
This pull request adds support for the mise
githubbackend. This is similar to theubibackend except the version constraints allowed for it seem to be more limited.Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
I used Claude Code to help with this PR. In particular, it helped significantly with the tests and making sure everything outside of the core logic was updated appropriately.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The public repository:
I tested it against our internal GitHub Enterprise Server instance.