Files
setup-kubectl/action.yml
Alexis Couvreur 5cbd56a156 feat: add version-file input to read kubectl version from .tool-versions (#261)
* feat: add version-file input to read kubectl version from .tool-versions

Adds a `version-file` input that reads the kubectl version from an
asdf/mise `.tool-versions` file. A specific `version` input takes
precedence (with a warning); the default `latest` lets the file decide.
Values from the file go through the same latest / major.minor /
major.minor.patch resolution and validation as the `version` input.
The file must be a regular, non-symlinked file of at most 64 KiB.

Closes #259

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* fix: address version-file review feedback

- Report a missing version-file with a clear error instead of a raw ENOENT
- Document that the first kubectl entry wins, and the regular-file / 64 KiB limits
- Assert that an explicit version skips reading the version-file entirely

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-09 12:38:30 -08:00

31 lines
1.2 KiB
YAML

name: 'Kubectl tool installer'
description: 'Install a specific version of kubectl binary. Acceptable values are latest or any semantic version string like "v1.15.0"'
inputs:
version:
description: 'Version of kubectl'
required: false
default: 'latest'
version-file:
description: 'Path to a .tool-versions (asdf/mise) file to read the kubectl version from. A specific version other than latest takes precedence.'
required: false
downloadBaseURL:
description: 'Base URL to download kubectl from (https only). Use for private mirrors.'
required: false
default: 'https://dl.k8s.io'
checksum:
description: 'Expected SHA256 of the kubectl binary (lowercase 64-char hex). Required when overriding downloadBaseURL; the action fails closed without it to prevent unverified binaries from poisoning the tool cache.'
required: false
default: ''
downloadAuthToken:
description: 'Optional bearer token sent as the Authorization header when fetching from downloadBaseURL. Stripped on cross-origin redirects.'
required: false
default: ''
outputs:
kubectl-path:
description: 'Path to the cached kubectl binary'
branding:
color: 'blue'
runs:
using: 'node24'
main: 'lib/index.js'