Skip to content

Add support for draft pullrequests #807

Closed
@acrobat

Description

@acrobat

public function create($username, $repository, array $params)
{
// Two ways to create PR, using issue or title
if (!isset($params['issue']) && !isset($params['title'])) {
throw new MissingArgumentException(['issue', 'title']);
}
if (!isset($params['base'], $params['head'])) {
throw new MissingArgumentException(['base', 'head']);
}
// If `issue` is not sent, then `body` must be sent
if (!isset($params['issue']) && !isset($params['body'])) {
throw new MissingArgumentException(['issue', 'body']);
}
return $this->post('/repos/'.rawurlencode($username).'/'.rawurlencode($repository).'/pulls', $params);
}

We should check the $params array if an option draft exists and is set to true. If so we should set the preview accept-header application/vnd.github.shadow-cat-preview+json

See: https://developer.github.com/changes/2019-02-14-draft-pull-requests/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions