feat: prioritize tools from cache#528
Conversation
WalkthroughThe changes modify the install function in Pre-merge checks❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
src/goreleaser.ts (2)
5-5: Alignosimport with other Node core importsOther Node core modules in this file use namespace imports (
import * as fs from 'fs', etc.). For consistency and to avoid relying on synthetic default imports, consider changing this to:-import os from 'os'; +import * as os from 'os';This keeps it aligned with typical
@types/nodepatterns and reduces dependence onesModuleInteropsettings.Please confirm this compiles cleanly with your current
tsconfig(especiallyesModuleInterop/allowSyntheticDefaultImports).
13-19: Cache lookup logic looks consistent with existing cachingThe cache-first path looks sound:
- Tool name (
'goreleaser-action') and version normalization (release.tag_name.replace(/^v/, '')) match the latertc.cacheDircall, so cache hits should resolve to the same directories.- Using
os.arch()for thetc.findarch parameter aligns with the default arch used when caching, so entries should be found for the current runner arch.- The returned executable path mirrors the existing
exePathconstruction, so behavior is consistent between cached and freshly-downloaded installs.One note: since
getReleaseis still called before checking the cache, you still incur a GitHub API call even on cache hits. If you ever want to fully avoid that on known exact versions (notlatest/aliases), you could consider a pre-getReleasecache check keyed off the requested version, but that’s an optional optimization and would require clear semantics for non-exact version inputs.If you’d like to double-check cache behavior, you can inspect existing cached directories on a runner to ensure they match the
findparameters (tool name, normalized tag, andos.arch()result).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/goreleaser.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/goreleaser.ts (1)
src/github.ts (1)
GitHubRelease(29-31)
No description provided.