Skip to content

Preserve setup-node steps that use node-version-file during runtime deduplication#35321

Merged
pelikhan merged 3 commits into
mainfrom
copilot/add-support-for-node-version-file
May 27, 2026
Merged

Preserve setup-node steps that use node-version-file during runtime deduplication#35321
pelikhan merged 3 commits into
mainfrom
copilot/add-support-for-node-version-file

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 27, 2026

actions/setup-node steps configured with with.node-version-file were treated as non-custom and removed by runtime deduplication. This could cause the compiler to inject a generated node-version, effectively bypassing the user’s version-file-based setup intent.

  • Runtime deduplication behavior

    • Updated Node.js customization detection in DeduplicateRuntimeSetupStepsFromCustomSteps to treat non-empty with.node-version-file as user customization.
    • When present, the user-provided setup-node step is preserved and Node runtime auto-injection is filtered out for that workflow.
  • Regression coverage

    • Added TestDeduplicatePreservesUserNodeVersionFile to lock expected behavior:
      • preserves user setup-node step using node-version-file
      • does not inject default node-version: '24'
      • removes duplicate generated Node setup requirement
  • Illustrative case

steps:
  - uses: actions/setup-node@v6
    with:
      node-version-file: '.node-version'
      cache: yarn
  - name: Bootstrap
    run: yarn kbn bootstrap

With this change, the above step remains authoritative instead of being replaced by a generated setup step.

Copilot AI and others added 2 commits May 27, 2026 22:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add support for node-version-file in setup-node steps Preserve setup-node steps that use node-version-file during runtime deduplication May 27, 2026
Copilot AI requested a review from pelikhan May 27, 2026 22:11
@pelikhan pelikhan marked this pull request as ready for review May 27, 2026 22:19
Copilot AI review requested due to automatic review settings May 27, 2026 22:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes runtime deduplication so user-authored actions/setup-node steps that select Node.js via node-version-file are preserved instead of being replaced by generated Node setup.

Changes:

  • Treat non-empty with.node-version-file on Node setup steps as customization.
  • Filter the Node runtime requirement when such a customized setup step is preserved.
  • Add regression coverage for the node-version-file scenario.
Show a summary per file
File Description
pkg/workflow/runtime_deduplication.go Updates Node setup customization detection to preserve node-version-file usage.
pkg/workflow/runtime_setup_test.go Adds regression test covering preservation of user node-version-file setup.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@pelikhan pelikhan merged commit 2e30682 into main May 27, 2026
41 checks passed
@pelikhan pelikhan deleted the copilot/add-support-for-node-version-file branch May 27, 2026 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

node-version-file in setup-node steps is ignored

3 participants