SuperAPI AI Directory

kf-g-github-actions-self-hosted-ci-cache

Office & productivity

View repository

Updated 10-15 20:24

About this skill

GitHub Actions self-hosted CI cache conventions

Treat this SKILL.md as the entry point, and for details read the relevant file under references . Do not duplicate general GitHub Actions optimization procedures. This skill supplements only verified decisions for shortening execution time with self-hosted runner + mise + pnpm.

When to use

  • Newly designing, shortening, or reviewing a GHA workflow on a self-hosted runner
  • mise-action / pnpm install fixing a job dominated by
  • Rolling out build + deploy workflows
  • Lightening jobs that do not need build, such as cleanup
  • Deciding whether to introduce GHA cache

Prerequisites

  • Apple Silicon Mac Assumes a self-hosted runner (darwin/arm64) (the bootstrap policy is the same for other architectures)
  • mise + pnpm + node
  • Runner should be always running (avoid queue waiting)
  • workflow は runs-on: [self-hosted, <repo-slug>] is assumed (for label details, see sibling skill kf-g-github-actions-self-hosted-runner-label ). This skill focuses on cache / mise / pnpm and does not describe runner registration procedures

Summary of adopted patterns

Item Adopted
cache itself RUNNER_TOOL_CACHE Persistence (bootstrap step)
mise env MISE_DATA_DIR=$RUNNER_TOOL_CACHE/mise
pnpm env PNPM_CONFIG_STORE_DIR=$RUNNER_TOOL_CACHE/pnpm-store
mise-action cache: false
GHA cache Do not use (restore overhead is heavy on self-hosted)
mise config per workflow mise.*.toml separated
pnpm backend "npm:pnpm"(avoid aqua install failure)
Redundant steps mise install removed
cleanup job CLI-only lightweight config,pnpm install omitted

Reference for measured results (warm run)

Target Typical before improvement Typical after warm run Main cause
build+deploy job ~140s ~35–60s mise ~100s→~1s
cleanup job (after lightening) ~130s ~25–35s mise shortened + pnpm install omitted

warm run baseline: mise-action ~1s (log all tools are installed)、pnpm install around ~10s.

Remaining bottlenecks

  • pnpm install ~11s: even with store cache, every job node_modules linking is required
  • remote deploy step: waiting on cloud API (hard to shorten)
  • build ~7–8s: cache ROI is low, recommended to skip

How to read further

  1. bootstrap and env variables → bootstrap-runner-tool-cache.md
  2. mise config splitting → mise-ci-config-split.md
  3. Things you must not do → anti-patterns.md
  4. job lightening → job-lightweight-pattern.md
  5. measurement and next steps → measurement-and-verification.md

Reference files

Common checks

  • Is the bootstrap step immediately after checkout?
  • PNPM_CONFIG_STORE_DIR IsPNPM_STORE_DIR is it not only)
  • workflow/job env に ${{ runner.tool_cache }} not written
  • mise-action が cache: false か
  • actions/cache@v4 not added to pnpm/mise
  • Does the CI mise config not include dev-only tools (hooks etc.)?
  • cleanup job が build + full pnpm install not doing it even though it is unnecessary
  • runs-on Doeskf-g-github-actions-self-hosted-runner-label include the repo-slug label (see