# Generate deployments from merged pull requests

Looking to get started with [DORA metrics](https://help.swarmia.com/use-cases/track-dora-metrics)? Tracking how often a team deploys and the quality of these deploys is often not a trivial task. It's difficult to get a perfect solution right away, and often it's better to aim for a solution as the first step.

PR merge based deployments are only supported if you directly merge to the selected deploy branch. If you have automation that initiates deploys without pull requests based on a single branch, then you need to use [GitHub checks](https://help.swarmia.com/generate-deployments-from-github-checks) or the [Deployments API](https://help.swarmia.com/sending-deployment-information-to-swarmia) to inform Swarmia about deployments.

We backfill deployment data for the past 90 days.

## Limitations

Using PR merges as the deployment source has the following limitations:

* [**Time to deploy**](https://help.swarmia.com/metrics-and-definitions/dora-metrics/time-to-deploy) **is not available**. This is because we only know when the PR was merged, but don't get any signal when it is in production. This means that the [change lead time](https://help.swarmia.com/metrics-and-definitions/dora-metrics/change-lead-time) will be equal to the [pull request cycle time](https://help.swarmia.com/metrics-and-definitions/pull-request-cycle-time).
* [**Automatic rollback detection**](https://help.swarmia.com/use-cases/track-dora-metrics/automatic-change-failure-detection#rollback-detection) **is not available**. This is because we don't get the deployed version numbers from PR merges.
* **Only one environment is supported**. We assume all PR merges are deployed to production immediately.

## Configuration

[**Deployments**](https://app.swarmia.com/metrics/deployments) can use Pull Request merges as the input data.

1. [**Start by creating an application**](https://app.swarmia.com/settings/deployments) and giving it a name
2. Select "**Pull request merge creates a deploy**" as the **Deployment source**.
3. Select repository
4. Select the branch (or branch prefix) that most accurately represents your production deployment events. You can give this environment a name, although we recommend "production".
5. *Optional:* Add more environments based on the branch name or prefix. This allows you to view deployments from different environments on the [Metrics → DORA → Deployments](https://app.swarmia.com/metrics/dora/deployments) page.
6. Confirm the amount of deployment data to be created, and **Save**.

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2FF7TmniiLz0qAbjHDsqL1%2F003561%402x.png?alt=media&#x26;token=ec94a67d-a2d6-4ceb-8dfc-d39e2421cf1e" alt=""><figcaption></figcaption></figure>
