Skip to content

Commit

Permalink
Amend changes for draft pull request
Browse files Browse the repository at this point in the history
Passes the custom media type and draft parameters
to the request only if it is a draft pull request
as both parameters are only needed for this particular
feature, otherwise default parameters are used.
  • Loading branch information
Daniel Zullo committed Nov 24, 2019
1 parent a0c6c3f commit 6090334
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions git-hub
Original file line number Diff line number Diff line change
Expand Up @@ -1516,12 +1516,14 @@ class PullCmd (IssueCmd):
force=args.force_push)
infof("Creating pull request from branch {} to {}:{}",
remote_head, config.upstream, base)
media_type = "application/vnd.github.v3+json"
# The draft feature is only available in a custom media type
if args.draft:
# The draft feature is only available in a custom media type
media_type = "application/vnd.github.shadow-cat-preview+json"
pull = req.post(cls.url(), media_type, head=gh_head, base=base,
title=title, body=body, draft=args.draft)
pull = req.post(cls.url(), media_type, head=gh_head, base=base,
title=title, body=body, draft=args.draft)
else:
pull = req.post(cls.url(), head=gh_head, base=base,
title=title, body=body)
IssueCmd.UpdateCmd._do_update(pull['number'], args.labels,
args.assignee, args.milestone)
cls.print_issue_summary(pull)
Expand Down

0 comments on commit 6090334

Please sign in to comment.