Skip to content

Jaid/action-npm-install

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

action-npm-install

License Sponsor action-npm-install
Build status Commits since v1.2.4 Last commit Issues

GitHub Action for installing Node dependencies from package.json with the correct package manager automatically selected.

This is usually needed to prepare for other steps in a GitHub Actions workflow.

Example

Example workflow that runs whenever commits are pushed on branch master.

.github/workflows/example.yml

name: Try installing Node dependencies
on:
  push:
    branches: [master]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: actions/checkout
        uses: actions/checkout@v2.0.0
      - name: actions/setup-node
        uses: actions/setup-node@v1.4.1
        with:
          node-version: "13.9.0"
      - name: npm install
        uses: jaid/action-npm-install@v1.2.1

Options

Default Info
nodeEnv development NODE_ENV setting for installing execution (affects the amount of dependencies installed, but I would recommend keeping development in any case).
packageManager auto Can be "npm", "yarn", "pnpm" or "auto". "auto" will determine the package manager by looking into the repo's files. This is very accurate, so you normally don't want to change this.
skipIfNodeModulesExists false If true and node_modules folder already exists, this action will be skipped assuming npm install is not required.

Development

Setting up:

git clone git@github.com:jaid/action-npm-install.git
cd action-npm-install
npm install

License

MIT License
Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/jaid)