Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Node 20 vs Node 24 for GitHub Actions: Migration Guide

· 6 min read · Home Tech

In this article
  1. Background: Node.js Versions and GitHub Actions
  2. How GitHub Actions Uses Node.js
  3. Node 20 vs Node 24: Key Differences for Workflows
  4. Migration Steps: Moving from Node 20 to Node 24
  5. Common Problems and Misconceptions
  6. How to Choose Between Node 20 and Node 24
  7. Cost and Maintenance Considerations
  8. Alternatives and Future-Proofing
  9. Frequently Asked Questions

Node 24 is the current LTS release and is fully supported in GitHub Actions, while Node 20 is in maintenance mode and will reach end-of-life in April 2026. This article compares the two for GitHub Actions compatibility, explains what changes when you migrate, and answers common questions about runtime versions in workflows.

Background: Node.js Versions and GitHub Actions

GitHub Actions runs on a hosted runner (ubuntu-latest, windows-latest, macos-latest) that comes with several Node.js versions pre-installed. The runner uses Node.js to execute JavaScript-based actions and to run the actions/github-script action. For years, the default Node version on runners was 16, then 20, and now 24 is the default on ubuntu-latest since early 2025.

Node 20 entered LTS in October 2023 and is in maintenance until April 2026. Node 24 became LTS in October 2025 (even-numbered releases are LTS). GitHub Actions officially supports the LTS versions of Node.js, and as of late 2025, Node 24 is fully supported. The key difference for users is that workflows that explicitly use node-version: 20 will continue to work, but you'll miss out on performance and security improvements, and you'll eventually need to move to 24 or later.

How GitHub Actions Uses Node.js

There are two main ways Node.js appears in GitHub Actions:

  • Action runtime: JavaScript actions (like actions/checkout or actions/setup-node) run on the runner's Node.js. The runner has a default version, but you can override it with the ACTION_NODE_VERSION environment variable or by using a specific runner label.
  • Your workflow code: You can run your own Node.js scripts using actions/github-script or by using setup-node to install a specific version for your build/test steps.

When you use actions/setup-node, you specify a version like node-version: 20 or node-version: 24. This installs that version on the runner and adds it to PATH. The version you choose affects your build tools, npm, and any Node-based scripts you run.

Node 20 vs Node 24: Key Differences for Workflows

Here are the most relevant differences when migrating from Node 20 to Node 24 in GitHub Actions:

  • Performance: Node 24 includes V8 engine improvements that make JavaScript execution faster. Benchmarks show roughly 10-20% improvement in many workloads, which can speed up test suites and build scripts.
  • Native TypeScript support: Node 24 can run TypeScript files directly with type stripping, so you don't need a separate build step for simple scripts. This is a big convenience for github-script or custom actions.
  • Security: Node 24 has the latest security patches and supports newer TLS and crypto features. Node 20 will stop receiving security updates after April 2026, so staying on it after that is risky.
  • API changes: Some deprecated APIs in Node 20 are removed in Node 24. If your action code uses deprecated functions (like fs.existsSync with a callback), you'll need to update.
  • npm version: Node 24 ships with npm 11, while Node 20 has npm 10. npm 11 is faster and has some new features, but it's mostly backward compatible.

Migration Steps: Moving from Node 20 to Node 24

Here's a practical checklist for migrating your GitHub Actions workflows:

  1. Check your workflow files for any node-version specification. Update node-version: 20 to node-version: 24.
  2. Test with a matrix: Run your workflows against both versions to catch issues. Use a matrix like node-version: [20, 24] to compare.
  3. Update JavaScript actions: If you maintain a custom JavaScript action, update its action.yml to specify runs.using: 'node24' instead of 'node20'.
  4. Check for deprecated APIs: Run your action code with --pending-deprecation flag to see warnings. Fix any that appear.
  5. Update dependencies: Run npm update to get versions of your packages that support Node 24.
  6. Verify with a dry run: Use act locally or push to a test branch to confirm everything works.

Common Problems and Misconceptions

One common misconception is that Node 20 is still the default on GitHub Actions. Actually, as of 2025, ubuntu-latest runners use Node 24 as the default. If you don't specify a version, you're already on Node 24.

Another issue: some old JavaScript actions are pinned to node20 in their action.yml. These will still work because the runner includes both Node 20 and 24, but they'll run on the older runtime. You can force them to use Node 24 by setting the ACTION_NODE_VERSION environment variable to 24.

A frequent problem is that your code uses node:test or other modules that behave differently. For example, node:test in Node 24 has better mocking support, but also stricter error checking. If your tests rely on loose error handling, they might break.

How to Choose Between Node 20 and Node 24

For new workflows, use Node 24. It's the current LTS, has better performance, and is fully supported. For existing workflows, the decision depends on your dependencies:

  • If your packages are all compatible with Node 24 (most are), migrate now.
  • If you have a legacy dependency that requires Node 20, you can keep using it until April 2026, but plan to upgrade.
  • If you're using actions/github-script, note that it defaults to the runner's Node version, so it will already be on 24.

Always test in a staging environment before switching production workflows. Use the matrix approach to run both versions side-by-side.

Cost and Maintenance Considerations

There's no direct cost difference between Node versions in GitHub Actions—you pay for compute time, not the runtime. However, Node 24's performance improvements can reduce your billable minutes because your jobs finish faster. For example, a test suite that takes 10 minutes on Node 20 might take 8 minutes on Node 24, saving you 2 minutes of runner time.

Maintenance-wise, Node 20 is in maintenance mode, meaning only critical security fixes are backported. Node 24 gets full updates. After April 2026, Node 20 will be completely unsupported, so staying on it means you're responsible for any security issues.

Alternatives and Future-Proofing

If you're not ready to move to Node 24, you could also consider Node 22, which is also LTS (until 2027). It's a middle ground with many of Node 24's features but slightly older. However, Node 22 is already less performant than 24, and you'll eventually need to move anyway.

Looking ahead, Node 26 will be released in April 2026, and GitHub Actions will likely adopt it as the default in 2027. To future-proof, keep your workflows simple and avoid hardcoding version numbers unless necessary. Use node-version-file to read from a .nvmrc file in your repo, so you can update the version in one place.

Frequently Asked Questions

Will my Node 20 actions stop working on GitHub Actions?

No, they will continue to work as long as GitHub supports Node 20 on runners, which is until at least April 2026. After that, the runner might remove Node 20, and actions that specify node20 will fail. It's best to update before then.

How do I check which Node version my workflow is using?

Add a step in your workflow: run: node -v. This prints the version. You can also use actions/setup-node with node-version: 24 to force a specific version.

Can I use Node 24 with older actions like checkout or setup-node?

Yes. These actions are maintained and support Node 24. They use the runner's default Node, which is already 24. If you have a custom action that specifies node20, it will still run, but you can override with ACTION_NODE_VERSION.

What is the difference between Node 20 and Node 24 for github-script?

actions/github-script uses the runner's Node version, so it will be 24 by default. This means you get native TypeScript support and better performance. If you previously had to compile TypeScript, you can now write it directly.

Is there any reason to stay on Node 20?

Only if you have a dependency that is incompatible with Node 24. For example, some native modules might not have pre-built binaries for Node 24. In that case, you can use Node 20 temporarily, but you should push for an update.

How do I update a custom JavaScript action to Node 24?

Edit the action.yml file and change runs.using from node20 to node24. Then test the action. If it uses any deprecated APIs, update them. Also update the node-version in any setup steps.