---
name: "github-actions-cache-dependencies"
description: "Eliminate slow build step download times using actions/cache and hashFiles keys."
metadata:
  author: "Actions"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "configure actions cache hashfiles"
  - "cache pnpm store github actions"
  - "debug gha cache hit miss"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# GitHub Actions Dependency Caching Optimization

Optimizes GitHub Actions caching: configuring actions/cache with primary and restore-keys, caching pnpm store / npm / pip / Cargo caches, handling cache eviction, and debugging cache hits/misses.

## When to Invoke
Invoke this skill whenever you need to:
- configure actions cache hashfiles
- cache pnpm store github actions
- debug gha cache hit miss

## Execution SOP & Rules
1. Use actions/cache@v4 specifying path, key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}.
2. Define restore-keys: [ '${{ runner.os }}-pnpm-' ] to reuse existing layers on minor edits.
3. For Node/Python setups, prefer built-in setup-node/setup-python cache: 'pnpm' or cache: 'pip'.
4. Monitor repository cache usage under GitHub Actions -> Caches to stay within the 10GB quota.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
