Eagerly provision the project's pinned Node + caching/compat fixes#3
Merged
Conversation
Provision Node unconditionally so later build steps are warm instead of paying a lazy Node download mid-build: - B2: drop the `if:` guard on the provision step. With no inputs (the common case) run a bare `nub node install`, which resolves the full pin chain (devEngines.runtime -> .node-version -> .nvmrc -> engines.node) and installs the concrete version. A no-pin project is detected from the "no Node pin" message and skipped gracefully (no failure); any other failure is a warning and nub provisions lazily at runtime. An explicit node-version / node-version-file still wins as a warm-up override. - B2 doc: document checkout-first (the provision reads pin files off disk) in the README, and add a soft ::warning:: when no package.json / .node-version / .nvmrc is present in the working directory. - S6: when reading a *.json node-version-file, prefer devEngines.runtime.version, then fall back to engines.node. - S3: cache input compat shim — treat any non-empty value that isn't `false` as truthy (so a setup-node-style `cache: npm` enables caching), and emit an informational note when a PM name is passed. - S5: correct the "project-level .npmrc" wording to "temporary user-level .npmrc (via NPM_CONFIG_USERCONFIG)" in action.yml and README. - S1: fix the `^0.0` example in the nub-version description to `^0.1.0`. Smoke: add an eager-provision job (no node-version input on a pinned fixture, asserts the pin is installed + emitted) and a no-pin job (asserts the action does not fail without a pin).
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.
Implements a batch of DX fixes from the setup-nub audit. The headline change makes Node provisioning eager by default so build steps run warm.
What changed
node-version/node-version-filewas set; with empty inputs it provisioned nothing and the project's Node downloaded lazily mid-build. It now runs unconditionally:nub node install, which resolves the full pin chain (devEngines.runtime→.node-version→.nvmrc→engines.node), resolves ranges against the live Node index, and installs the concrete version up front.::warning::and nub falls back to lazy provisioning at runtime.node-version/node-version-filestill wins as a warm-up override; the project-pin mismatch warning and Windows backslash-normalization ofnub node whichare preserved, and thenode-versionoutput still populates.actions/checkoutmust run before setup-nub. Documented prominently in the README; the step also emits a soft::warning::when none ofpackage.json/.node-version/.nvmrcis present (hinting at a missing checkout) — it does not fail.node-version-fileJSON readsdevEngines.runtimefirst (S6). For a*.jsonfile it now prefersdevEngines.runtime.version, then falls back toengines.node— not justengines.node.cachevalue-type compat shim (S3). setup-node'scachetakes a PM name; setup-nub's is a boolean. A new normalize step treats any non-empty value that isn'tfalseas truthy (so a drop-incache: npmenables caching) and emits an informational note when a PM name is passed. The three cache steps now gate on this normalized flag..npmrc" → "temporary user-level.npmrc(viaNPM_CONFIG_USERCONFIG)" in action.yml input descriptions and the README (it writes to$RUNNER_TEMP/.npmrc, not a project file).nub-versiondescription's^0.0example →^0.1.0.Verification
actionlintclean onsmoke.ymlapart from the pre-existingSC2193/SC2016style warnings the file already carries (the one new SC2193 is the identical== 20*comparison pattern already used in thepre-provisionjob).cacheflag,provision) passshellcheck -s bashwith no findings; theset -euo pipefailinteractions on the tolerated-failure paths (no-pin skip, empty-outshort-circuit,|| rc=$?capture) were verified empirically.manage::install_from_pinemits"... no version given and no Node pin (devEngines.runtime, ...").eager-provision— nonode-versioninput on a.node-version-pinned fixture; assertsnub node lsshows the pinned 20.x and thenode-versionoutput is populated (proves eager provision fired).no-pin— a pin-less fixture; asserts the action does not fail.Recommend-only follow-ups (maintainer-owned)
cachedefault totrue. The S3 truthiness shim is included here, but flipping the default fromfalsetotrueis a user-facing default the maintainer owns; not changed in this PR. Recommended as a follow-up.v0tag. The README already references@v0; cutting thev0release/tag is left to the maintainer post-merge.