This GitHub Action automates the setup of Node.js and efficiently manages dependency caching using Yarn. It helps reduce workflow execution time by caching and restoring node_modules based on your yarn.lock and package.json files.
- 📦 Automatic Node.js setup using .nvmrc file
- 🚀 Smart caching of node_modules and Yarn state
- ⚡ Optimized dependency installation
- 🔄 Automatic cache updates on dependency changes
Add this action to your workflow:
steps:
- uses: actions/checkout@v4
- uses: Act-Aks/cached-setup@v1- A
.nvmrcfile in your repository specifying the Node.js version yarn.lockandpackage.jsonfiles for dependency management
- Sets up Node.js based on your .nvmrc file
- Attempts to restore cached dependencies
- Installs dependencies if cache miss occurs
- Saves the new cache for future workflows
The action uses the following cache key format:
{runner.os}-yarn-{hash of yarn.lock}-{hash of package.json files}
Fallback keys:
{runner.os}-yarn-{hash of yarn.lock}
{runner.os}-yarn-
name: Build and Test
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: Act-Aks/cached-setup@v1
- run: yarn build
- run: yarn testContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Act-Aks