fix: implement version pinning with @actions/tool-cache v4#11
Merged
danielmeppiel merged 1 commit intomainfrom Mar 11, 2026
Merged
fix: implement version pinning with @actions/tool-cache v4#11danielmeppiel merged 1 commit intomainfrom
danielmeppiel merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors APM CLI installation to download versioned release assets directly (with caching), adds unit tests around the new installer/version resolution logic, and introduces a workflow to validate version pinning behavior in CI.
Changes:
- Replace
install.shpiping with GitHub Releases asset download +@actions/tool-cacheextraction/caching. - Add
getAssetSuffixandresolveDownloadUrlhelpers (including “latest” resolution). - Add Jest unit tests for installer behavior and a CI workflow to validate pinned/latest installs.
Reviewed changes
Copilot reviewed 4 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/installer.ts |
Implements release-asset-based installation, tool-cache caching, and version URL resolution. |
src/__tests__/installer.test.ts |
Adds unit coverage for platform suffix mapping, URL resolution, and install/caching behavior. |
package.json |
Adds @actions/tool-cache dependency. |
package-lock.json |
Locks @actions/tool-cache (and its transitive deps). |
dist/licenses.txt |
Updates bundled third-party license list. |
dist/installer.d.ts |
Updates declarations for newly exported installer helpers. |
.github/workflows/test-version-pin.yml |
Adds integration workflow to validate pinned/latest version installs on Ubuntu/macOS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
098aec1 to
1daf2e0
Compare
Replace broken install.sh pipe (which ignored APM_VERSION env var) with direct binary download using @actions/tool-cache. This enables proper version pinning via the apm-version input. - Use GitHub Releases API to resolve 'latest' tag - Construct download URL from predictable asset naming convention - Download, extract, and cache with @actions/tool-cache - Map process.platform/arch to APM asset suffix (4 combos) - Add 14 unit tests covering all platform combos, URL resolution, cache hits, and error paths - Add test-version-pin.yml workflow (Ubuntu + macOS, pinned + latest)
1daf2e0 to
9613dc2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Version Pinning with @actions/tool-cache v4
Problem
The
apm-versioninput was broken —install.shignores theAPM_VERSIONenv var the action sets, always installing the latest version regardless of what you specify.Solution
Replace the
curl install.sh | shapproach with direct binary download using@actions/tool-cachev4 (the standard pattern used by setup-node, setup-python, setup-go):latesttag or constructs URL for pinned versionsWhat Changed
src/installer.ts— Rewritten to use @actions/tool-cache v4src/__tests__/installer.test.ts— 14 new unit testspackage.json— Added @actions/tool-cache ^4.0.0.github/workflows/test-version-pin.yml— E2E test: pinned v0.7.5 on Ubuntu + macOS, plus latestTesting