setup-node
Set up your GitHub Actions workflow with a specific version of node.js
This is an official GitHub Action that installs a specific version of Node.js into a GitHub Actions workflow. GitHub Actions is GitHub's built-in system for automating tasks like running tests, building code, or deploying software whenever you push changes to a repository. Many of those tasks require Node.js to be available, and this action handles fetching, caching, and configuring the right version so you do not have to do it manually in each workflow.
You specify the Node.js version you want using standard version notation, such as a major version number like 22, a precise version like 22.17.1, or aliases like lts/iron for the current long-term support release. The action checks a local cache on the runner first to avoid downloading the same version repeatedly, which speeds up workflows that run frequently. If the version is not cached, it downloads from GitHub's own node-versions releases or falls back to the official Node.js distribution servers.
The action also handles dependency caching for npm, yarn, and pnpm. When caching is enabled, it saves the packages your project downloads so they do not have to be fetched from the internet on every workflow run. Starting with version 5, npm caching is enabled automatically when your package.json declares npm as the package manager. For private package registries, the action can configure authentication tokens so that npm or yarn can install packages that require credentials.
Using it in a workflow requires just a few lines of YAML. You add a step that references actions/setup-node with your chosen version, and from that point on the rest of the workflow has access to the node and npm commands at that version. The action is maintained by GitHub and is one of the most widely used actions in the ecosystem.