Skip to content

Add version-file input to read the Helm version from a .tool-versions file#281

Merged
bosesuneha merged 2 commits into
Azure:mainfrom
somaz94:feat/version-file
Jun 23, 2026
Merged

Add version-file input to read the Helm version from a .tool-versions file#281
bosesuneha merged 2 commits into
Azure:mainfrom
somaz94:feat/version-file

Conversation

@somaz94

@somaz94 somaz94 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Closes #272.

Adds a version-file input that reads the Helm version from a .tool-versions file (the format used by asdf and mise), mirroring the *-version-file inputs in actions/setup-go and actions/setup-node.

Behavior

  • version-file points to a .tool-versions file; the action reads the version declared for the helm tool (e.g. helm 3.18.4).
  • The parsed version flows through the existing normalization, so an unprefixed 3.18.4 resolves to v3.18.4, and latest is honored.
  • If both version and version-file are set, version takes precedence (a warning is emitted), matching actions/setup-go.
  • Clear errors when the file is missing or declares no helm version.
  • The version input is relaxed to required: false (default latest unchanged).

Validation

  • npm run typecheck — passes
  • npm test (vitest) — 26/26 pass, including 7 new tests covering the parser, the file reader, precedence, and error paths
  • npm run format-check — clean

lib/ is gitignored and built by the release workflow, so no bundle is committed here.

@somaz94

somaz94 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

somaz94 added a commit to somaz94/somaz94 that referenced this pull request Jun 11, 2026
@somaz94 somaz94 marked this pull request as ready for review June 11, 2026 06:48
@somaz94 somaz94 requested a review from a team as a code owner June 11, 2026 06:48
Comment thread src/run.ts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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-file input and implement .tool-versions parsing + file reading to resolve helm version.
  • Relax version input to required: false while keeping latest as the default.
  • Document version-file usage 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.

Comment thread src/run.ts Outdated
Comment thread src/run.ts
Comment thread README.md Outdated
Comment thread README.md Outdated

@bosesuneha bosesuneha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm

@bosesuneha bosesuneha requested a review from Tatsinnit June 23, 2026 18:58

@Tatsinnit Tatsinnit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

❤️ 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.)

@bosesuneha bosesuneha enabled auto-merge (squash) June 23, 2026 20:06
@bosesuneha bosesuneha merged commit 017211e into Azure:main Jun 23, 2026
10 checks passed
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

Successfully merging this pull request may close these issues.

Feature Request: Add version-file input

4 participants