Add version-file input to read the Helm version from a .tool-versions file#281
Conversation
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Pull request overview
Adds support for resolving the Helm version from a .tool-versions file via a new version-file action input, integrating it into the existing version normalization flow used by azure/setup-helm.
Changes:
- Add
version-fileinput and implement.tool-versionsparsing + file reading to resolvehelmversion. - Relax
versioninput torequired: falsewhile keepinglatestas the default. - Document
version-fileusage in the README and add unit tests for the parser/file reader helpers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/run.ts |
Adds version-file resolution in run(), plus .tool-versions parsing and file-reading helpers. |
src/run.test.ts |
Extends mocks and adds unit tests for parsing and reading .tool-versions. |
README.md |
Documents the new version-file input and expected .tool-versions format. |
action.yml |
Adds the version-file input and makes version non-required (default remains latest). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
❤️ Thank you so much for this contribution, The lenient regex is fine because:
- It's checking for
"semver-shaped"strings, not strict validation - It correctly rejects clearly wrong values like latest or
3.14 - Edge cases like
3.14.0---would likely fail when actually trying to download that Helm version anyway
So it's good for the intended purpose of distinguishing version numbers from keywords, even if not perfectly spec-compliant. (but that's just a note for other folks to see like @davidgamero or @bosesuneha - who are regular for this repo releases.)
Closes #272.
Adds a
version-fileinput that reads the Helm version from a.tool-versionsfile (the format used by asdf and mise), mirroring the*-version-fileinputs inactions/setup-goandactions/setup-node.Behavior
version-filepoints to a.tool-versionsfile; the action reads the version declared for thehelmtool (e.g.helm 3.18.4).3.18.4resolves tov3.18.4, andlatestis honored.versionandversion-fileare set,versiontakes precedence (a warning is emitted), matchingactions/setup-go.helmversion.versioninput is relaxed torequired: false(defaultlatestunchanged).Validation
npm run typecheck— passesnpm test(vitest) — 26/26 pass, including 7 new tests covering the parser, the file reader, precedence, and error pathsnpm run format-check— cleanlib/is gitignored and built by the release workflow, so no bundle is committed here.