@@ -504,7 +504,7 @@ def create_commit(self, message, tree, parents, author={}, committer={}):
504504
505505 @requires_auth
506506 def create_deployment (self , ref , force = False , payload = '' ,
507- auto_merge = False , description = '' ):
507+ auto_merge = False , description = '' , environment = None ):
508508 """Create a deployment.
509509
510510 :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='',
516516 :param bool auto_merge: Optional parameter to merge the default branch
517517 into the requested deployment branch if necessary. Default: False
518518 :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"
519521 :returns: :class:`Deployment <github3.repos.deployment.Deployment>`
520522 """
521523 json = None
522524 if ref :
523525 url = self ._build_url ('deployments' , base_url = self ._api )
524526 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 )
526530 headers = Deployment .CUSTOM_HEADERS
527531 json = self ._json (self ._post (url , data = data , headers = headers ),
528532 201 )
0 commit comments