🚨 CI/CD Enhancement Request: Auto-detect pnpm cache setup dependencies

Resolved πŸ’¬ 4 comments Opened Aug 10, 2025 by workmusicalflow Closed Jan 7, 2026

🚨 CI/CD Pipeline Failure - pnpm Cache Setup Issue

🎯 Problem Summary

GitHub Actions workflow fails at "Setup Node.js & pnpm cache" step with actions/setup-node@v4 when using cache: 'pnpm' because pnpm is not pre-installed.

πŸ” Root Cause Analysis

  • Error: actions/setup-node@v4 with cache: 'pnpm' requires pnpm to be installed BEFORE the setup-node step
  • Impact: All CI/CD workflows hanging/failing on dependency resolution
  • Context: pnpm workspace monorepo with NestJS API + Nuxt.js web apps

βœ… Solution Implemented

# BEFORE (❌ Fails)
- name: πŸ“¦ Setup Node.js & pnpm cache
  uses: actions/setup-node@v4
  with:
    node-version: '20'
    cache: 'pnpm'  # ❌ Fails - pnpm not installed yet

# AFTER (βœ… Works)
- name: πŸ“¦ Setup pnpm
  uses: pnpm/action-setup@v2
  with:
    version: 8
    
- name: πŸ“¦ Setup Node.js & pnpm cache  
  uses: actions/setup-node@v4
  with:
    node-version: '20'
    cache: 'pnpm'  # βœ… Works - pnpm now available

πŸ”§ Technical Details

  • Repository: pnpm workspace monorepo
  • Node.js: v20
  • pnpm: v8
  • Actions:
  • actions/setup-node@v4
  • pnpm/action-setup@v2

πŸ“‹ Additional Optimizations Applied

env:
  PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
  PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
  HUSKY: 0

jobs:
  build:
    timeout-minutes: 15  # Prevent hanging jobs
    steps:
      - name: πŸ“¦ Setup pnpm
        uses: pnpm/action-setup@v2
        with:
          version: 8
          
      - name: πŸ“¦ Setup Node.js & pnpm cache
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'pnpm'
          
      - name: πŸ“₯ Install dependencies
        run: pnpm install --frozen-lockfile

🎯 Request for Claude Code Support

Could Claude Code GitHub Actions be enhanced to:

  1. Auto-detect pnpm requirements: When cache: 'pnpm' is used, automatically suggest adding pnpm/action-setup first
  2. Workflow validation: Check action order dependencies before committing workflow files
  3. Monorepo templates: Provide optimized workflow templates for pnpm workspaces
  4. Timeout recommendations: Suggest appropriate timeout-minutes based on project size

πŸ“Š Current Status

  • βœ… Issue identified and fixed manually
  • βœ… Shadow workflow ci-cd-mvp-v2.yml created for testing
  • πŸ”„ Monitoring pipeline execution
  • ⏳ Ready for PR to main branch once validated

πŸ”— Related Files

  • .github/workflows/ci-cd-mvp-v2.yml (fixed workflow)
  • pnpm-workspace.yaml (monorepo config)
  • package.json (workspace root)

πŸ’‘ Impact

This fix enables reliable CI/CD for pnpm monorepos and prevents common setup-node cache failures that affect many TypeScript/Node.js projects.

---
Priority: High - Blocks all CI/CD operations
Environment: GitHub Actions, pnpm workspace, Node.js 20
Fix Applied: βœ… Working solution implemented

View original on GitHub β†—

This issue has 4 comments on GitHub. Read the full discussion on GitHub β†—