Skip to content

CICD-381 · Monorepo directory detection ​

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

Previous · CICD-380 · Next · CICD-382

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
git diff --name-only "${BASE_SHA:?}...HEAD" -- apps/ packages/ | awk -F/ 'NF>2 {print $1 "/" $2}' | sort -u

3. How it works ​

git diff lists paths changed since the merge base. The field projection reduces them to candidate package roots and leaves shared-dependency handling to the planner.

4. Verify the result ​

Use an agreed base and detect shared paths. A root lockfile change can require testing every package.

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