> ## Documentation Index
> Fetch the complete documentation index at: https://www.towbar.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Automation and previews

> Opt a Service into automatic deployment, PR previews, notification routing, and scanning.

Repository sync does not by itself deploy a service. Opt in with `autoDeploy`, then list the repository paths that can change the built result:

```yaml title=".towbar/services/web.service.yml" theme={"system"}
id: web
name: Web
autoDeploy:
  inputs:
    - package.json
    - pnpm-lock.yaml
    - apps/web/**
```

Include shared libraries, lockfiles, build scripts, and Dockerfiles as needed. The Repository's automation control can pause automatic work during maintenance. A manual **Deploy** remains a separate action. Start with one manual deployment and verify the running service before enabling automation.

## Pull request previews

Enable previews for an environment in `towbar.yml`, then opt the Service in with a base domain:

<CodeGroup>
  ```yaml title="towbar.yml" theme={"system"}
  version: 2
  environments:
    staging:
      previews:
        enabled: true
  ```

  ```yaml title=".towbar/services/web.service.yml" theme={"system"}
  preview:
    enabled: true
    domain: preview.example.com
    ttlHours: 72
  environments:
    staging:
      server: 192.0.2.11
  ```
</CodeGroup>

Eligible pull requests target the branch mapped to `staging`. Preview secrets are isolated from persistent environment values; datastores do not create previews. Read [Preview environments](/docs/previews) for expiry and cleanup.

## Other automation

Use `notifications` to route a Service's events to additional workspace-configured destinations. It takes effect after a successful environment sync without a deployment. `vulnerabilityScanning` controls image scanning, while `jobs` runs scheduled commands from the deployed image. Follow [Notifications](/docs/integrations/notifications), [Vulnerability scanning](/docs/vulnerability-scanning), and [Scheduled jobs](/docs/services/jobs) for their separate configuration and execution rules.
