Add Node.js 20 deprecation warning annotation (Phase 1)#4242
Add Node.js 20 deprecation warning annotation (Phase 1)#4242
Conversation
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.
There was a problem hiding this comment.
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.warnonnode20feature 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. |
src/Runner.Worker/JobExtension.cs
Outdated
| 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}"; |
There was a problem hiding this comment.
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.
| 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}"; |
| { | ||
| 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. " + |
There was a problem hiding this comment.
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.
| "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. " + |
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.warnonnode20feature 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:Also adds the blog post link to the Phase 2 (
useNode24ByDefault) info message.Changes
WarnOnNode20Flagfeature flag (actions.runner.warnonnode20) andNode20DeprecationUrlblog post constantDeprecatedNode20ActionsHashSet to track Node.js 20 actions across the jobDeprecatedNode20Actionsset during job initializationGetActionNamehelper. Also adds blog post link to Phase 2 messageFinalizeJobTesting
All 742 tests pass.