Skip to content

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

Open
salmanmkc wants to merge 6 commits intomainfrom
salmanmkc/node20-deprecation-warning
Open

Add Node.js 20 deprecation warning annotation (Phase 1)#4242
salmanmkc wants to merge 6 commits intomainfrom
salmanmkc/node20-deprecation-warning

Conversation

@salmanmkc
Copy link
Contributor

Summary

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

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/checkout@v4, some-org/action@v1. 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. Also adds blog post link to Phase 2 message
  • JobExtension.cs - Emits deprecation warning annotation listing all Node.js 20 actions in FinalizeJob
  • 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

Testing

All 742 tests pass.

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.
@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.
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.

1 participant