You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Deployment and DeploymentStatus API enhancements preview period
3
+
author_name: tarebyte
4
+
---
5
+
6
+
We've expanded our Deployments APIs to accommodate more powerful deployment practices and to lay the foundation for a more seamless integration of deployments within GitHub.
7
+
8
+
## Link to a live deployment
9
+
10
+
To enable easy access to a live version of a deployment, we've added an `environment_url` field to the Deployments API. This environment will be exposed as a link in the Pull Request timeline to enable users to directly access a running version of their code without leaving the context of their work.
11
+
12
+
*Note: To add some clarity, we've renamed the `target_url` field to `log_url`. We will continue accept `target_url` to support legacy uses, but we recommend modifying this to the new name to avoid confusion. Future API versions might not support `target_url`*.
13
+
14
+
## Inactive deployment status
15
+
16
+
We recognize that deployments in many common practices don't last forever. So, we've added a new `inactive` state to Deployment Statuses. You can use this state to communicate that a deployment is no longer active (e.g. something different has been deployed to the environment or the environment has been destroyed).
17
+
18
+
## More information about environments
19
+
20
+
We've expanded our Deployments API to provide additional information about the environments associated with deployments.
21
+
22
+
We've added a new `transient_environment` field to allow you to communicate that an environment is specific to a deployment and will no longer exist at some point in the future (e.g. a temporary testing environment like a [Heroku Review App][heroku-review-app]). By pairing this with other additions, we can determine that an `inactive` deployment associated with a `transient_environment` has an `environment_url` that is no longer accessible.
23
+
24
+
Similarly, we've added a new `production_environment` field to allow you to communicate that an environment is one with which end users directly interact. We automatically set `production_environment` to `true` if the value for `environment` is ``"production"``.
25
+
26
+
## Automatic creation of inactive statuses
27
+
28
+
Each time we receive a new successful deployment status, we automatically add a new `inactive` status to all previous deployments made within the relevant repository to the same environment (based on the value of `environment`) given the environment is both non-transient and non-production. You can opt out of this behavior by passing `false` with the new `auto_inactive` parameter.
29
+
30
+
For example, if `feature-branch` within `https://github.com/user/repository` is deployed to an environment named `staging` (which is a non-transient, non-production environment) and `bugfix-branch` within `https://github.com/user/repository` is later deployed to an environment named `staging`, we would automatically create a new `inactive` status for the deployment associated with `feature-branch`.
31
+
32
+
#### How can I try it?
33
+
34
+
Starting today, these API enhancements are available for developers to preview. At the end of the preview period, these enhancements will become official components of the GitHub API.
35
+
36
+
To access the API during the preview period, you must provide a custom [media type][media-types] in the Accept header:
37
+
38
+
```
39
+
application/vnd.github.ant-man-preview+json
40
+
```
41
+
42
+
During the preview period, we may change aspects of these enhancements. If we do, we will announce the changes on the developer blog, but we will not provide any advance notice.
43
+
44
+
Take a look at [the documentation][docs] for full details. We would love to hear your thoughts on these enhancements. If you have any questions or feedback, please [get in touch with us][contact]!
Copy file name to clipboardExpand all lines: content/v3/repos/deployments.md
+39-1Lines changed: 39 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,23 @@ Name | Type | Description
138
138
`payload`|`string` | Optional JSON payload with extra information about the deployment. Default: `""`
139
139
`environment`|`string` | Optional name for the target deployment environment (e.g., production, staging, qa). Default: `"production"`
140
140
`description`|`string` | Optional short description. Default: `""`
141
+
{% if page.version == 'dotcom' || page.version >= 2.6 %} `transient_environment` | `boolean` | Optionally specifies if the given environment is specific to the deployment and will no longer exist at some point in the future. Default: `false`**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
142
+
{% if page.version == 'dotcom' || page.version >= 2.6 %} `production_environment` | `boolean` | Optionally specifies if the given environment is one that end-users directly interact with. Default: `true` when `environment` is `"production"` and `false` otherwise. **This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
143
+
144
+
{% if page.version == 'dotcom' || page.version >= 2.6 %}
145
+
{{#tip}}
146
+
147
+
The new `transient_environment` and `production_environment` parameters are currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the [blog post][blog-post] for full details.
148
+
149
+
To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
150
+
151
+
```
152
+
application/vnd.github.ant-man-preview+json
153
+
```
154
+
155
+
{{/tip}}
156
+
157
+
{% endif %}
141
158
142
159
#### Simple Example
143
160
@@ -221,9 +238,28 @@ Users with push access can create deployment statuses for a given deployment:
221
238
222
239
Name | Type | Description
223
240
-----|------|--------------
224
-
`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, or `failure`.
241
+
`state`|`string` | **Required**. The state of the status. Can be one of `pending`, `success`, `error`, {% if page.version == 'dotcom' || page.version >= 2.6 %} `inactive`, {% endif %}or `failure`**The `inactive` state requires a custom media type to be specified. Please see more in the alert below.**.
225
242
`target_url`|`string` | The target URL to associate with this status. This URL should contain output to keep the user updated while the task is running or serve as historical information for what happened in the deployment. Default: `""`
243
+
{% if page.version == 'dotcom' || page.version >= 2.6 %}`log_url`|`string` | This is functionally equivalent to `target_url`. We will continue accept `target_url` to support legacy uses, but we recommend modifying this to the new name to avoid confusion. Default: `""`**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
226
244
`description`|`string` | A short description of the status. Maximum length of 140 characters. Default: `""`
245
+
{% if page.version == 'dotcom' || page.version >= 2.6 %}`environment_url`|`string`| Optionally set the URL for accessing your environment. Default: `""`**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
246
+
{% if page.version == 'dotcom' || page.version >= 2.6 %}`auto_inactive`|`boolean`| Optional parameter to add a new `inactive` status to all non-transient, non-production environment deployments with the same repository and environment name as the created status's deployment. Default: `true`**This parameter requires a custom media type to be specified. Please see more in the alert below.**{% endif %}
247
+
248
+
{% if page.version == 'dotcom' || page.version >= 2.6 %}
249
+
250
+
{{#tip}}
251
+
252
+
The new `inactive` state, rename of the `target_url` parameter to `log_url` and new `environment_url` and `auto_inactive` parameters are currently available for developers to preview. During the preview period, the API may change without advance notice. Please see the [blog post][blog-post] for full details.
253
+
254
+
To access the API during the preview period, you must provide a custom [media type](/v3/media) in the `Accept` header:
0 commit comments