Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add Node.js 20 deprecation warning annotation (Phase 1)#4242

Merged
salmanmkc merged 7 commits intomainfrom
salmanmkc/node20-deprecation-warning
Feb 19, 2026
Merged

Add Node.js 20 deprecation warning annotation (Phase 1)#4242
salmanmkc merged 7 commits intomainfrom
salmanmkc/node20-deprecation-warning

Conversation

@salmanmkc
Copy link
Contributor

@salmanmkc salmanmkc commented Feb 11, 2026

Summary

Adds a deprecation warning annotation for Node.js 20 actions as part of the Node 20 → Node 24 migration Phase 1 (see #3948).

Node.js 20 reaches end-of-life in April 2026. When the actions.runner.warnonnode20 feature flag is enabled, the runner collects all actions using Node.js 20 (including node12/16 that get migrated to node20) during the job and emits a single warning annotation at job finalization:

Node.js 20 is approaching end-of-life and will be replaced by Node.js 24 as the default runner on June 2nd, 2026. The following actions use Node.js 20: actions/checkout@v4, some-org/action@v1. Please update these actions to versions that support Node.js 24. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

Also adds the blog post link to the Phase 2 (useNode24ByDefault) info message.

Changes

  • Constants.cs — Added WarnOnNode20Flag feature flag (actions.runner.warnonnode20) and Node20DeprecationUrl blog post constant
  • GlobalContext.cs — Added DeprecatedNode20Actions HashSet to track Node.js 20 actions across the job
  • ExecutionContext.cs — Initializes the DeprecatedNode20Actions set during job initialization
  • HandlerFactory.cs — Tracks Node.js 20 actions when the warn flag is enabled; added GetActionName helper with sanitization to prevent log injection. Also adds blog post link to Phase 2 message
  • JobExtension.cs — Emits deprecation warning annotation listing all Node.js 20 actions in FinalizeJob. Truncates to 10 actions with "... and N more" for large workflows
  • HandlerFactoryL0.cs — 4 new tests covering: tracking when flag enabled, not tracking when disabled, not tracking node24 actions, and tracking node12 actions that get migrated
  • JobExtensionL0.cs — Tests for deprecation warning formatting, truncation, sorting, and sanitization

Testing

All tests pass.

@salmanmkc salmanmkc requested a review from a team as a code owner February 11, 2026 13:41
Copilot AI review requested due to automatic review settings February 11, 2026 13:41
Copy link
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

Adds Phase 1 support for emitting a single end-of-job warning annotation when deprecated Node.js 20 (including node12/16 upgraded to node20) actions are used, as part of the Node 20 → Node 24 migration strategy.

Changes:

  • Introduces actions.runner.warnonnode20 feature flag and a Node 20 deprecation URL constant.
  • Tracks Node.js 20-based actions during handler creation and aggregates them per job.
  • Emits a single warning at job finalization listing all tracked actions; adds L0 coverage for tracking behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/Runner.Common/Constants.cs Adds warn-on-node20 feature flag constant and Node 20 deprecation URL constant.
src/Runner.Worker/GlobalContext.cs Adds DeprecatedNode20Actions set to hold per-job tracked action identifiers.
src/Runner.Worker/ExecutionContext.cs Initializes Global.DeprecatedNode20Actions during job initialization.
src/Runner.Worker/Handlers/HandlerFactory.cs Tracks node20 actions when flag enabled; adds helper to format action name; appends deprecation URL to Phase 2 message.
src/Runner.Worker/JobExtension.cs Emits one end-of-job warning annotation listing all tracked node20 actions.
src/Test/L0/Worker/HandlerFactoryL0.cs Adds L0 tests validating tracking behavior under different node versions and flag states.

if (context.Global.DeprecatedNode20Actions?.Count > 0)
{
var actionsList = string.Join(", ", context.Global.DeprecatedNode20Actions);
var deprecationMessage = $"Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: {actionsList}. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2025. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: {Constants.Runner.NodeMigration.Node20DeprecationUrl}";
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The deprecation warning hard-codes the cutoff date ("June 2nd, 2025") directly in the string. To avoid this becoming stale and to keep deprecation messaging centralized (similar to Node20DeprecationUrl), consider moving the date (and potentially the full template) into Constants.Runner.NodeMigration and referencing it here.

Suggested change
var deprecationMessage = $"Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: {actionsList}. Actions will be forced to run with Node.js 24 by default starting June 2nd, 2025. Please check if updated versions of these actions are available that support Node.js 24. To opt into Node.js 24 now, set the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true environment variable. Once Node.js 24 becomes the default, you can temporarily opt out by setting ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true. For more information see: {Constants.Runner.NodeMigration.Node20DeprecationUrl}";
var deprecationMessage = $"Node.js 20 actions are deprecated. The following actions are running on Node.js 20 and may not work as expected: {actionsList}. Actions will be forced to run with Node.js 24 by default in the future. Please check if updated versions of these actions are available that support Node.js 24. For the latest deprecation schedule and more information, see: {Constants.Runner.NodeMigration.Node20DeprecationUrl}";

Copilot uses AI. Check for mistakes.
{
string infoMessage = "Node 20 is being deprecated. This workflow is running with Node 24 by default. " +
"If you need to temporarily use Node 20, you can set the ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true environment variable.";
"If you need to temporarily use Node 20, you can set the ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true environment variable. " +
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

The Phase 2 info message hard-codes the environment variable name ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION. Since there is already a constant (Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable), using it here would prevent the message from drifting if the variable name ever changes and keeps the string consistent with the rest of the migration code.

Suggested change
"If you need to temporarily use Node 20, you can set the ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION=true environment variable. " +
$"If you need to temporarily use Node 20, you can set the {Constants.Runner.NodeMigration.AllowUnsecureNodeVersionVariable}=true environment variable. " +

Copilot uses AI. Check for mistakes.
@salmanmkc salmanmkc force-pushed the salmanmkc/node20-deprecation-warning branch 2 times, most recently from 9630663 to 0211e73 Compare February 18, 2026 14:30
@salmanmkc salmanmkc closed this Feb 18, 2026
@salmanmkc salmanmkc force-pushed the salmanmkc/node20-deprecation-warning branch from 0211e73 to e012ab6 Compare February 18, 2026 14:40
@salmanmkc salmanmkc reopened this Feb 18, 2026
@salmanmkc salmanmkc force-pushed the salmanmkc/node20-deprecation-warning branch from 98d239e to 061be52 Compare February 18, 2026 15:08
When the actions.runner.warnonnode20 feature flag is enabled, the runner
collects all actions using Node.js 20 (including node12/16 that get
migrated to node20) during the job and emits a single warning annotation
at job finalization:

"Node.js 20 actions are deprecated and will stop working on June 2nd,
2025. Please update the following actions to use Node.js 24: {actions}.
For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/"

Also adds the blog post link to the Phase 2 (node24 default) info message.
ericsciple
ericsciple previously approved these changes Feb 19, 2026
@ericsciple ericsciple self-requested a review February 19, 2026 16:47
@salmanmkc salmanmkc force-pushed the salmanmkc/node20-deprecation-warning branch from 061be52 to 747bd95 Compare February 19, 2026 16:52
@salmanmkc salmanmkc merged commit 9426c35 into main Feb 19, 2026
12 checks passed
@salmanmkc salmanmkc deleted the salmanmkc/node20-deprecation-warning branch February 19, 2026 17:05
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.

4 participants