@@ -504,7 +504,7 @@ def create_commit(self, message, tree, parents, author={}, committer={}):
504
504
505
505
@requires_auth
506
506
def create_deployment (self , ref , force = False , payload = '' ,
507
- auto_merge = False , description = '' ):
507
+ auto_merge = False , description = '' , environment = None ):
508
508
"""Create a deployment.
509
509
510
510
:param str ref: (required), The ref to deploy. This can be a branch,
@@ -516,13 +516,17 @@ def create_deployment(self, ref, force=False, payload='',
516
516
:param bool auto_merge: Optional parameter to merge the default branch
517
517
into the requested deployment branch if necessary. Default: False
518
518
:param str description: Optional short description. Default: ""
519
+ :param str environment: Optional name for the target deployment
520
+ environment (e.g., production, staging, qa). Default: "production"
519
521
:returns: :class:`Deployment <github3.repos.deployment.Deployment>`
520
522
"""
521
523
json = None
522
524
if ref :
523
525
url = self ._build_url ('deployments' , base_url = self ._api )
524
526
data = {'ref' : ref , 'force' : force , 'payload' : payload ,
525
- 'auto_merge' : auto_merge , 'description' : description }
527
+ 'auto_merge' : auto_merge , 'description' : description ,
528
+ 'environment' : environment }
529
+ self ._remove_none (data )
526
530
headers = Deployment .CUSTOM_HEADERS
527
531
json = self ._json (self ._post (url , data = data , headers = headers ),
528
532
201 )
0 commit comments