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: New features for the Deployments API preview
4
+
created_at: 2014-08-15
5
+
author_name: atmos
6
+
---
7
+
8
+
We've added two new feature to the [Deployments API preview][deployments-preview]: the ability to query deployments and a new `task` attribute for different types of deployment tasks.
9
+
10
+
## API Changes
11
+
12
+
You can now search for deployments via query parameters to the [listing endpoint][listing-endpoint]. You can filter on `sha`, `ref`, `task`, and `environment`. This makes it easier to answer questions like "when was the last time someone deployed to staging?"
We've also added a `task` attribute to the deployments model. The `task` attribute exists to allow you to specify tasks other than just pushing code. Popular deployment tools like [capistrano][capistrano] and [fabric][fabric] support named tasks to do things like run schema migrations. We hope this attribute will give integrators the flexibility they need to provide custom functionality.
22
+
23
+
If you have any questions or feedback, please [get in touch][contact].
Deployments offer a few configurable parameters with sane defaults.
108
+
109
+
The `ref` parameter can be any named branch, tag, or sha. At GitHub we often
110
+
deploy branches and verify them before we merge a pull request.
111
+
112
+
The `environment` parameters allows deployments to be issued to different
113
+
runtime environments. Teams often have multiple environments for verifying
114
+
their applications, like 'production', 'staging', and 'qa'. This allows for
115
+
easy tracking of which environments had deployments requested. The default
116
+
environment is 'production'
100
117
101
118
The `auto_merge` parameter is used to ensure that the requested ref is not
102
119
behind the repository's default branch. If the ref *is* behind the default
103
120
branch for the repository, we will attempt to merge it for you. If the merge
104
121
succeeds, the API will return a successful merge commit. If merge conflicts
105
122
prevent the merge from succeeding, the API will return a failure response.
106
123
107
-
By default, [commit statuses](/v3/repos/statuses) for every submitted context must be in a 'success' state. The `required_contexts` parameter allows you to specify a subset of contexts that must be "success", or to specify contexts that have not yet been submitted. You are not required to use commit statuses to deploy. If you do not require any contexts or create any commit statuses, the deployment will always succeed.
124
+
By default, [commit statuses](/v3/repos/statuses) for every submitted context
125
+
must be in a 'success' state. The `required_contexts` parameter allows you to
126
+
specify a subset of contexts that must be "success", or to specify contexts
127
+
that have not yet been submitted. You are not required to use commit statuses
128
+
to deploy. If you do not require any contexts or create any commit statuses,
129
+
the deployment will always succeed.
108
130
109
131
The `payload` parameter is available for any extra information that a
110
132
deployment system might need. It is a JSON text field that will be passed on
111
133
when a deployment event is dispatched.
112
134
113
-
Users with push access can create a deployment for a given ref:
135
+
The `task` parameter is used by the deployment system to allow different
136
+
execution paths. In the web world this might be 'deploy:migrations' to run
137
+
schema changes on the system. In the compiled world this could be a flag to
138
+
compile an application with debugging enabled.
139
+
140
+
Users with `repo` or `repo_deployment` scopes can create a deployment for a given ref:
114
141
115
142
POST /repos/:owner/:repo/deployments
116
143
@@ -119,6 +146,7 @@ Users with push access can create a deployment for a given ref:
119
146
Name | Type | Description
120
147
-----|------|--------------
121
148
`ref`|`string`| **Required**. The ref to deploy. This can be a branch, tag, or sha.
149
+
`task`|`string`| **Required**. The named task to execute. e.g. `deploy` or `deploy:migrations`. Default: `deploy`
122
150
`auto_merge`|`boolean`| Optional parameter to merge the default branch into the requested ref if it is behind the default branch. Default: `true`
123
151
`required_contexts`|`Array`| Optional array of status contexts verified against commit status checks. If this parameter is omitted from the parameters then all unique contexts will be verified before a deployment is created. To bypass checking entirely pass an empty array. Defaults to all unique contexts.
124
152
`payload`|`string` | Optional JSON payload with extra information about the deployment. Default: `""`
0 commit comments