NexisChat Docs
ActionsWorkflows

Change Detection

Detects modified workspaces (apps/*, packages/*) and outputs a JSON array for downstream matrix jobs.

The reusable Change Detection workflow computes which workspaces changed between two refs, with robust fallbacks.

Infrastructure

  • Runner: Self-hosted dokploy runner

Interface

  • Inputs (optional): base_ref, head_ref
  • Outputs:
    • modified_dirs: JSON array of workspace paths
    • has_changes: boolean-like string
    • changed_files: JSON array of changed files

Logic

  1. Determine base/head based on provided inputs or event:
    • Pull Request (synchronize): Compare only changes from the last push (github.event.before to github.event.after) to avoid re-running checks on unchanged files
    • Pull Request (opened/reopened): Compare full PR changes (base.sha to head.sha)
    • Push to main/master/develop: Run all checks on all workspace components to ensure nothing breaks on merge
    • Push to other branches: Compare incremental changes from the last push
    • First push: Compare against origin/main|master when available
  2. git diff --name-only base head
  3. Extract apps/<name> and packages/<name> directories from the changed file list.
  4. If any changed file is outside apps/* or packages/*, include all workspaces (e.g. a root config change).
  5. Deduplicate and sort results.
  6. Fallback: if no diff can be computed, include all existing workspace dirs that contain a package.json.

Output formatting

  • Uses the multiline <<EOF syntax for GITHUB_OUTPUT to safely emit large JSON payloads for modified_dirs and changed_files.

Why this matters

Only changed components flow into the matrix job, dramatically reducing CI time.