Skip to content

CICD-383 · Test affected packages only ​

Encyclopedia · Monorepo and large-scale build engineering · All snippets

Previous · CICD-382 · Next · CICD-384

1. Where it fits ​

  • Placement CI run step or authorized lab terminal.
  • Prerequisites trusted checkout with the base ref fetched and pinned package manager or build tool.
  • Platforms local-linux, github-actions, gitea-actions.
  • Parameters BASE_SHA.

2. Copy the snippet ​

bash
pnpm exec nx affected -t test --base="${BASE_SHA:?}" --head=HEAD

3. How it works ​

Nx uses the Git range and project graph to find affected projects, including dependents. It then runs their configured test targets.

4. Verify the result ​

Install locked dependencies and ensure scope includes changes to shared inputs.

Validation syntax-validated (Bash parse). Status definitions.