# Deploy Affected Components

Run CI jobs only for component instances affected by a change. Atmos produces the job matrix from your stacks and Git changes.

Complete [Setup and Authentication](/integrations/gitea-actions/setup) first.

## Workflow

Fan out across only the components that changed in the pull request using `atmos describe affected --format=matrix`. With `ci.enabled: true`, Atmos writes the `matrix` and `count` outputs to the runner's output file automatically.

`atmos git clone --ci` clones full history by default, which gives `describe affected` the pull request's base commit. Atmos reads that base from the event payload. The `plan` job checks `count != '0'` to skip empty matrices.

This pull request workflow only plans. Deploy after a protected merge, as shown in [Apply on Merge](/integrations/gitea-actions/apply-on-merge). Both jobs check out the event revision so the matrix and plans use the same commit.

Add `--labels=ci:auto` to select only components labeled for this workflow. See
[Choosing which components run in CI](/ci#keeping-privileged-components-out-of-ci).
