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 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
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. |
Setting up:
git clone git@github.com:jaid/action-npm-install.git
cd action-npm-install
npm install
MIT License
Copyright © 2020, Jaid <jaid.jsx@gmail.com> (https://github.com/jaid)