Skip setup-node when requested version already installed#40442
Closed
Skip setup-node when requested version already installed#40442
Conversation
Workaround for actions/setup-node#1492 where specifying node-version on ubuntu-slim triggers unnecessary downloads instead of using cached versions. This change: - Adds a check-node-version step that compares current Node version with requested version - Skips setup-node call if versions match (handles "24", "24.x", and "24.13.0" patterns) - Reduces build time by avoiding slow downloads on ubuntu-slim runners Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
Next Steps to Merge⌛ Please wait. Next steps to merge this PR are being evaluated by automation. ⌛Comment generated by summarize-checks workflow run. |
Changes based on code review: - Use empty string instead of "none" sentinel value for missing Node - Add explicit comment explaining two separate regex checks - Simplify logic by using empty string checks consistently Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
- Restructure version extraction to ensure fallback works correctly
- Use CURRENT_VERSION=${CURRENT_VERSION#v} instead of sed in pipe
- Apply Prettier formatting (remove trailing spaces)
Co-authored-by: mikeharder <9459391+mikeharder@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add version check before calling setup-node
Skip setup-node when requested version already installed
Feb 13, 2026
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.
On
ubuntu-slimrunners,setup-nodewith version patterns like24.xdownloads the latest patch version instead of using the cached version, causing unnecessary network overhead (actions/setup-node#1492).Changes
Modified
.github/actions/setup-node-install-deps/action.yaml:node -vand compares with requested version before calling setup-node"24"): matches any 24.x.x"24.x"): matches any 24.x.x"24.13.0"): requires exact matchExisting npm install and dependency management behavior unchanged.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.