Skip to content

Nx

Nx CI on GitHub Actions

Nx rebuilds every project because it cannot tell what changed.

48 → 3
Projects built
22m → 4m
Pipeline

Nx rebuilds every project because it cannot tell what changed.

Why it happens

The Nx cache directory is not persisted and the base SHA for affected detection is wrong in CI.

What to change

  1. Cache .nx/cache and set up Nx remote caching
  2. Use nx affected with the correct --base so only changed projects build
  3. Enable nx-cloud distributed task execution for large graphs
  4. Fetch enough git history for affected detection to work — shallow clones break it

Nx on runnerhut

yaml
jobs:
build:
runs-on: runnerhut-8vcpu-ubuntu-2404
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: npm ci
- run: npx nx affected -t build test --base=origin/main
A working starting point

The only runnerhut-specific line is `runs-on: runnerhut-8vcpu-ubuntu-2404`. Everything else is standard GitHub Actions — the same actions, the same secrets and the same permissions model you use today.

Your next build could be twice as fast, at half the price

Start free. Migrating away is the same one line, and we publish that diff too.