# Build triggers (/docs/builds/triggers)



With the [GitHub App](/docs/builds/github) installed, builds can start on their own when you push, open a pull request or push a tag. Add `triggers` to `liftbay.json`:

```json title="liftbay.json"
{
  "build": {
    "profiles": {
      "preview": { "environment": "preview", "distribution": "internal", "platforms": ["ios", "android"] },
      "production": { "environment": "production", "distribution": "store", "platforms": ["ios", "android"] }
    },
    "triggers": [
      { "on": "push", "branches": ["main"], "profile": "production" },
      { "on": "pull_request", "branches": ["main"], "profile": "preview", "platforms": ["android"] },
      { "on": "tag", "tags": ["v*"], "profile": "production", "submit": true }
    ]
  }
}
```

Liftbay reads `liftbay.json` at the commit that was pushed, so a change to the triggers applies from that commit on.

## Trigger fields [#trigger-fields]

| Field       | Meaning                                                                       |
| ----------- | ----------------------------------------------------------------------------- |
| `on`        | `push` (to a branch), `pull_request` (opened, new commits, reopened) or `tag` |
| `branches`  | `push`: the branch pushed to. `pull_request`: the base branch. Default: any   |
| `tags`      | `tag`: the tag name. Default: any                                             |
| `profile`   | The build profile to use (its environment and distribution)                   |
| `platforms` | Default: the profile's platforms                                              |
| `submit`    | Submit to the store when the build succeeds                                   |

Branch and tag patterns are globs: `*` matches within one path segment (`release/*` matches `release/1.6`), `**` across segments (`release/**` matches `release/1.6/hotfix`), `?` one character.

## What never builds [#what-never-builds]

* Commits whose message, or pull requests whose title, contains `[skip ci]`, `[ci skip]` or `[liftbay skip]`.
* Pull requests from forks: they would run someone else's code with your project's secrets.
* Deleted branches and tags.
* A commit already built with the same profile and platform (for example a push and a pull request for the same commit).

`npx liftbay ci init` writes an empty `triggers` list; nothing builds on its own until you add one.

## Status on GitHub [#status-on-github]

Each build from a commit reports a commit status, named `Liftbay / Android (production)` or `Liftbay / iOS (preview)`. It shows next to the commit and in the pull request's checks, links to the build in the dashboard, and moves from pending to success, failure or error (cancelled).

Use it as a required status check in branch protection to block merges until the build passes.

<Callout title="Existing installations">
  Triggers need the app's `push` and `pull_request` events and the **Commit statuses: write** permission. If you installed the app before these were added, GitHub asks an organization owner to approve the new permission in the installation's settings.
</Callout>
