# Path filters for the CI gates (#788), read by dorny/paths-filter in action.yml. Each key is a
# gate: a PR whose diff matches none of a gate's globs skips that gate's jobs.

# Root shared config: a change here can perturb every workspace, so every gate below
# inherits it. The root tsconfig/eslint/prettier/tailwind globs are defensive - today
# those configs live in packages/config (matched by packages/** below), but a future
# root-level config must not silently skip gates.
sharedConfig: &sharedConfig
  - 'package.json'
  - 'pnpm-lock.yaml'
  - 'pnpm-workspace.yaml'
  - 'tsconfig*'
  - 'eslint*'
  - '.eslintrc*'
  - 'prettier*'
  - '.prettierrc*'
  - '.prettierignore'
  - 'tailwind*'
# Blanket CI-definition arm (#788): any workflow or local-action edit forces
# web/infra/docs/landing, whose broad suites (lint/build/deploy) a CI change could perturb.
allWorkflows: &allWorkflows
  - '.github/workflows/**'
  - '.github/actions/**'
# Narrow CI-definition arm for `ui` (#952): the ui gate drives only the storybook job
# (ci-storybook.yml: the static build, the Chromatic visual-regression step and the hosted
# Storybook deploy), so only the files that govern that job force it - an unrelated deploy
# (web/admin) or docs-only workflow edit does not run the Storybook build. Path filters match
# whole files, so any edit to ci.yml (which gates the job) or ci-test.yml (which also carries
# the @bloom/ui story-test steps) trips this too: a deliberate, safe over-run, never an
# under-run.
uiWorkflows: &uiWorkflows
  - '.github/workflows/ci.yml'
  - '.github/workflows/ci-storybook.yml'
  - '.github/workflows/ci-test.yml'
  - '.github/actions/changes/**'
web:
  - *sharedConfig
  - *allWorkflows
  - 'apps/admin/**'
  # apps/landing is a workspace package too, so the root pnpm -r fan-out
  # (lint/format/typecheck/test) must run when it changes.
  - 'apps/landing/**'
  # apps/docs is a workspace package, so the root pnpm -r lint/format/typecheck
  # fan-out covers it - an apps/docs change must run the workspace suite.
  - 'apps/docs/**'
  - 'apps/server/**'
  - 'apps/web/**'
  - 'packages/**'
  # The workflow-spec instance + schema live under apps/server (relocated in
  # #830); the TS server is their runtime consumer (BLOOM_WORKFLOW_SPEC_PATH) and
  # its vitest suites load the real instance through the zod loadSpec twin - so a
  # spec edit must run the TS suite.
  - 'apps/server/workflows/**'
# `ui` inherits the root shared config and the real UI trigger (packages/**), but only
# the Storybook-governing CI files above - NOT the blanket workflow arm (#952).
ui:
  - *sharedConfig
  - *uiWorkflows
  - 'packages/**'
infra:
  - *allWorkflows
  - 'deploy/**'
  - 'scripts/deploy/**'
# The docs site (M45-1) renders the repo docs/ tree in place, so a docs/ content
# edit can break the Docusaurus build without touching apps/docs. The build also
# generates the TypeDoc API reference (M45-4) from packages/api-client and
# packages/ui sources, so changes there must run the docs gate too.
docs:
  - *sharedConfig
  - *allWorkflows
  - 'apps/docs/**'
  - 'docs/**'
  - 'packages/api-client/**'
  - 'packages/ui/**'
# The landing site (M46-1) compiles @bloom/ui sources into its bundle and builds
# with the @bloom/config preset/tsconfig, so changes there must run its build gate.
landing:
  - *sharedConfig
  - *allWorkflows
  - 'apps/landing/**'
  - 'packages/config/**'
  - 'packages/ui/**'
