Repository navigation
Description
Optional Version Input and Major-Version Channels for setup-cli action
Suggested issue title: Make version optional in setup-cli action and support major-version channels
Goal: Allow users of actions/setup-cli to omit version and receive the latest stable release by default. Add forward-looking major-version channels such as v1 and v2, while preserving exact release-tag installation. gh-aw has not released v1 yet, so these channels will have no matching release until stable releases for those majors exist.
Architecture: Keep install-gh-aw.sh and install-gh-aw.ps1 as the canonical installers. Both installers should resolve major-version channels to the highest stable semantic version in that major, then use the resolved full release tag consistently for gh extension install, binary download, and checksum verification. Keep the two implementations behaviorally aligned and sync their copies into actions/setup-cli/ using the existing Make target.
Tech Stack: GitHub composite actions, Bash, PowerShell, GitHub Releases API, shell installer tests.
Problem
actions/setup-cli/action.yml currently marks version as required and has no default, while actions/setup-cli/README.md describes it as accepting only a release tag.
The canonical installer scripts already default to latest when no version is provided. However, that behavior cannot currently be used through the action because its metadata requires an input. The installers also treat values other than latest as exact release tags, so values such as v1 are not resolved to a release.
Current release status: gh-aw is still on the v0.x release line and does not yet have a v1 release. Therefore, v1 and later major channels are preparatory and cannot install a matching release today. The generic vN contract would include v0, which can resolve to the existing stable v0.x releases.
Expected Usage
Install the latest stable release without specifying a version:
- uses: github/gh-aw/actions/setup-cli@mainOnce a stable v1 release exists, install the latest stable release in that major-version channel:
- uses: github/gh-aw/actions/setup-cli@main
with:
version: v1Continue to support exact release tags:
- uses: github/gh-aw/actions/setup-cli@main
with:
version: v1.2.3Version Resolution Contract
- An omitted
versioninput is equivalent tolatest. latestcontinues to select the latest stable release overall.- A channel matching
vNselects the highest stable SemVer release tag in major versionN, for example,v1may resolve tov1.10.0. - The
vNsyntax includesv0;v0can resolve to the current stablev0.xrelease line. Channels such asv1have no target until a stable release in that major is published. - Prereleases must not be selected for
latestor a major-version channel. - Exact release tags continue to select that exact release.
- If a major-version channel has no matching stable release, installation fails with a clear error before replacing an existing installation.
- The resolved full tag is used consistently for installation, download, checksum verification, and version-mismatch checks.
Global Constraints
- Preserve existing exact-tag behavior and checksum verification.
- Keep Bash and PowerShell behavior consistent.
- Do not add runtime dependencies solely for version resolution.
- Do not change the
installed-versionoutput contract. - Continue to edit the root installer scripts as the canonical sources; generated copies under
actions/setup-cli/must be updated withmake sync-action-scripts. - Preserve the installers' existing staging and replacement safeguards.
Implementation Plan
Task 1: Update the action input contract
Files:
- Modify:
actions/setup-cli/action.yml
Changes:
- Set
required: falseforversion. - Set
default: latest. - Update the input description to list exact tags,
latest, and major-version channels (vN).
Acceptance check: The action metadata allows a caller to omit version and passes latest to the installer.
Task 2: Add Bash channel resolution and regression coverage
Files:
- Modify:
install-gh-aw.sh - Test:
scripts/test-install-script.sh
Changes:
- Resolve a
vNchannel through the GitHub Releases API. - Consider only non-prerelease releases whose tags are valid stable versions in that major.
- Select by SemVer ordering, not string ordering or API response order.
- Handle API pagination so an older matching stable release is not missed.
- Use the resolved tag for both the
gh extension install --pinpath and the direct-download fallback. - Fail clearly if no matching stable release exists.
Extend the existing mocked installer tests with cases covering:
INPUT_VERSIONunset resolves tolatest.- A channel selects the highest stable version, including a numeric-ordering case such as
v1.9.0versusv1.10.0. - A newer prerelease is ignored in favor of the latest stable release.
- Releases from other major versions are ignored.
- Pagination finds a matching release on a later page.
- A channel with no stable release fails without replacing an existing binary.
- A
v1request currently follows the no-matching-stable-release behavior; tests must not imply that a v1 release already exists. - Exact release tags retain their current behavior.
Task 3: Implement equivalent PowerShell behavior
Files:
- Modify:
install-gh-aw.ps1 - Test: Add or extend focused PowerShell/Windows coverage using the repository's existing test conventions.
Changes:
- Implement the same channel syntax, stable-release filtering, SemVer selection, pagination, and failure behavior as the Bash installer.
- Ensure both the
ghinstallation path and manual-download fallback use the same resolved tag. - Verify that exact tags and
latestkeep their existing behavior.
Task 4: Update action documentation and sync generated scripts
Files:
- Modify:
actions/setup-cli/README.md - Generated copies:
actions/setup-cli/install.sh,actions/setup-cli/install.ps1
Changes:
- Document that
versionis optional and defaults tolatest. - Document exact tags and
vNchannels, including that major-version channels are beta and thatv1has no matching release yet. - Add examples for omitting
version, usingv1, and using an exact tag. - Regenerate the action script copies with
make sync-action-scripts.
Validation Plan
- Run
bash scripts/test-install-script.sh install-gh-aw.sh. - Run
bash actions/setup-cli/install_test.sh. - Run the focused PowerShell/Windows tests added or updated for this behavior.
- Run
make agent-finishas required by the repository's contribution guidance.
Acceptance Criteria
- Callers can use the action without passing
version; it installs the latest stable release. vNselects the highest stable SemVer release in that major and never selects a prerelease.- The documentation and tests make clear that
v1and later channels are forward-looking until those stable release lines exist;v0can resolve the current release line. - A channel without a matching stable release fails with a clear error and does not replace an existing installation.
- Exact release tags continue to work.
- Bash and PowerShell produce equivalent results and use the resolved release tag throughout installation.
- The action README and generated installer copies are up to date.
Activity