Change Detection
The reusable Change Detection workflow computes which workspaces changed between two refs, with robust fallbacks.
Infrastructure
Section titled “Infrastructure”- Runner: Self-hosted
dokployrunner
Interface
Section titled “Interface”- Inputs (optional):
base_ref,head_ref - Outputs:
modified_dirs: JSON array of workspace pathshas_changes: boolean-like stringchanged_files: JSON array of changed files
- Determine base/head based on provided inputs or event:
- Pull Request (synchronize): Compare only changes from the last push (
github.event.beforetogithub.event.after) to avoid re-running checks on unchanged files - Pull Request (opened/reopened): Compare full PR changes (
base.shatohead.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|masterwhen available
- Pull Request (synchronize): Compare only changes from the last push (
git diff --name-only base head- Extract
apps/<name>andpackages/<name>directories from the changed file list. - If any changed file is outside
apps/*orpackages/*, include all workspaces (e.g. a root config change). - Deduplicate and sort results.
- Fallback: if no diff can be computed, include all existing workspace dirs that contain a
package.json.
Output formatting
Section titled “Output formatting”- Uses the multiline
<<EOFsyntax forGITHUB_OUTPUTto safely emit large JSON payloads formodified_dirsandchanged_files.
Why this matters
Section titled “Why this matters”Only changed components flow into the matrix job, dramatically reducing CI time.