Skip to content

Node 20 deprecation warning fires even when FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 forces the action to run on Node 24 #4295

@blalor

Description

@blalor

Summary

When FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true is set in a workflow's env: section, JavaScript actions with using: node20 are correctly upgraded to run on Node 24 at runtime — but the end-of-job deprecation annotation still fires with the misleading message:

The following actions are running on Node.js 20 and may not work as expected: some-action@v1

The action is not actually running on Node 20. The annotation text is inaccurate.

Root cause

In HandlerFactory.cs, the deprecation tracking happens before DetermineActionsNodeVersion is called:

// 1. Deprecation tracking — based on declared version, runs FIRST
if (nodeData.NodeVersion == "node20") {
    if (warnOnNode20)
        executionContext.Global.DeprecatedNode20Actions?.Add(actionName); // always added
}

// 2. Version upgrade check — runs SECOND, may upgrade to node24
if (nodeData.NodeVersion == "node20") {
    var (nodeVersion, _) = NodeUtil.DetermineActionsNodeVersion(environment, ...);
    nodeData.NodeVersion = finalNodeVersion; // could be "node24" if FORCE_ is set
}

The action is added to DeprecatedNode20Actions based on its declared version (node20) before DetermineActionsNodeVersion has a chance to check the FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 env var and upgrade the runtime to node24. The end-of-job warning then iterates over that list and claims the actions "are running on Node.js 20", even though they ran on Node 24.

Expected behavior

If FORCE_JAVASCRIPT_ACTIONS_TO_NODE24=true causes an action to run on Node 24, the end-of-job annotation should either:

  • Not fire at all for that action (preferred — the user has already opted in), or
  • Use accurate language like "declared for Node.js 20" rather than "running on Node.js 20"

Steps to reproduce

  1. Set FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" at the workflow env: level
  2. Use any action that declares using: node20 in its action.yml
  3. Observe that the "Complete job" step still emits the Node 20 deprecation annotation

Suggested fix

Move the deprecation tracking to after DetermineActionsNodeVersion resolves the final runtime version, so the warning only fires for actions that will actually execute on Node 20:

// Determine actual runtime version first
if (nodeData.NodeVersion == "node20") {
    var (nodeVersion, _) = NodeUtil.DetermineActionsNodeVersion(environment, ...);
    nodeData.NodeVersion = finalNodeVersion;
}

// Only warn if the action is still going to run on node20
if (nodeData.NodeVersion == "node20") {
    if (warnOnNode20)
        executionContext.Global.DeprecatedNode20Actions?.Add(actionName);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions