File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -345,6 +345,7 @@ def create(
345345 source_branch : str ,
346346 title : str ,
347347 description : Optional [str ] = None ,
348+ labels : Optional [List [str ]] = None ,
348349 ) -> "PullRequest" :
349350 """
350351 Create a pull request to ``owner``/``repo`` to the ``base`` branch.
@@ -358,13 +359,18 @@ def create(
358359 :param source_branch: Name of the source branch in the source (forked) repo.
359360 :param title: Pull request title.
360361 :param description: Pull request description.
362+ :param labels: List of labels to be associated with the pull request.
361363 """
362364 url = conn .makeurl ("repos" , target_owner , target_repo , "pulls" )
365+ if labels :
366+ ids = cls ._get_label_ids (conn , target_owner , target_repo )
367+ labels = [ids [i ] for i in labels ]
363368 data = {
364369 "base" : target_branch ,
365370 "head" : f"{ source_owner } :{ source_branch } " ,
366371 "title" : title ,
367372 "body" : description ,
373+ "labels" : labels ,
368374 }
369375 response = conn .request ("POST" , url , json_data = data )
370376 obj = cls (response .json (), response = response , conn = conn )
You can’t perform that action at this time.
0 commit comments