Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

README.md

Prepare Node.js in GitHub Actions

This action provides the following functionality for GitHub Actions users:

  • Set up Node.js with a specific version
  • Load caching npm dependencies
  • Run npm ci with or without the --ignore-scripts option
  • Log the version information of node and npm

Usage

See action.yml

Basic:

jobs:
  Build:
    name: Build bundle
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v6

      - name: Prepare node
        uses: woocommerce/grow/prepare-node@actions-v3
        with:
          node-version: 24

      - name: Build bundle
        run: npm run build

Must specify either node-version or node-version-file option to set the version.

Supported version syntax

Specify the node version via a file:

steps:
  - name: Checkout repository
  - uses: actions/checkout@v6

  - name: Prepare node
    uses: woocommerce/grow/prepare-node@actions-v3
    with:
      node-version-file: ".nvmrc"

Specify the cache dependency path:

steps:
  - name: Checkout repository
  - uses: actions/checkout@v6

  - name: Prepare node
    uses: woocommerce/grow/prepare-node@actions-v3
    with:
      node-version: 24
      cache-dependency-path: "./packages/github-actions"

Skip the npm ci

steps:
  - name: Checkout repository
    uses: actions/checkout@v6

  - name: Prepare node
    uses: woocommerce/grow/prepare-node@actions-v3
    with:
      node-version: "lts/*"
      install-deps: "no"

  - name: My task
    run: npm outdated

Run npm ci with the --ignore-scripts option

steps:
  - name: Checkout repository
    uses: actions/checkout@v6

  - name: Prepare node
    uses: woocommerce/grow/prepare-node@actions-v3
    with:
      node-version: "latest"
      ignore-scripts: "no"

  - name: My task
    run: npm run lint:js