Snippet
Github Actions Node Actions Template
Run Node package commands in Github Actions
Sunny Golovine
Things to change:
yarn.lock
to your lockfile.Base Template:
yaml
name: Pull Request CI
# on: workflow_dispatch
on:
pull_request:
branches:
- main
jobs:
pr-tests:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: "16.13.2"
- name: Cache Node Modules
id: cache-node-modules
uses: actions/cache@v2
with:
path: node_modules
key: node-modules-${{ hashFiles('yarn.lock') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install
- name: Run Node Command
run: yarn your_package_command
# Any Additional Commands
Copyright 2023, Sunny Golovine
Version: 1.2.0 (5345ace)