This GitHub Action sets up a Node.js environment by installing Node.js, checking out the repository, installing dependencies, and managing caching.
- Installs a specified version of Node.js
- Checks out the repository
- Supports caching of
node_modules - Creates an
.npmrcfile for GitHub Packages - Installs dependencies
jobs:
setup-node-env:
runs-on: ubuntu-latest
steps:
- name: Setup NodeJS Environment
uses: panates/gh-setup-node@v1
with:
PERSONAL_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
node-version: "20.18.3"
cache: "true"
cache-key: "my-cache-key"
install-deps: "true"- Ensure that
PERSONAL_ACCESS_TOKENhas access to GitHub Packages if you're using private repositories. - If caching is enabled, it will restore
node_modulesfrom cache using the specified cache key.
This project is licensed under the MIT License.
