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/[email protected]
- name: actions/setup-node
uses: actions/[email protected]
with:
node-version: "13.9.0"
- name: npm install
uses: jaid/[email protected]
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 [email protected]:jaid/action-npm-install.git
cd action-npm-install
npm install
MIT License
Copyright © 2020, Jaid <[email protected]> (https://github.com/jaid)