Skip to content

m github create_pr

Create a pull request.

https://docs.github.com/en/rest/reference/pulls#create-a-pull-request

example::

$ m github create_pr \
    --owner jmlopez-rod \
    --repo repo \
    --head feature_branch \
    --base master \
    --title 'PR Title' \
    @file_with_pr_body | m json
Source code in m/cli/commands/github/create_pr.py
class Arguments(BaseModel):
    r"""Create a pull request.

    https://docs.github.com/en/rest/reference/pulls#create-a-pull-request

    example::

        $ m github create_pr \
            --owner jmlopez-rod \
            --repo repo \
            --head feature_branch \
            --base master \
            --title 'PR Title' \
            @file_with_pr_body | m json
    """

    owner: str = Arg(
        default=env('GITHUB_REPOSITORY_OWNER'),
        help='repo owner',
    )
    repo: str = Arg(
        help='repo name',
        required=True,
    )
    head: str = Arg(
        help='name of the branch where the changes are implemented',
        required=True,
    )
    base: str = Arg(
        help='name of the branch you want the changes pulled into',
        required=True,
    )
    title: str = Arg(
        help='pull request title',
        required=True,
    )
    body: str = Arg(
        default='@-',
        help='data: @- (stdin), @filename (file), string',
        validator=validate_payload,
        positional=True,
    )

Required arguments

--repo

repo name

name of the branch where the changes are implemented

--base

name of the branch you want the changes pulled into

--title

pull request title

Options

--owner

  • default: 'jmlopez-rod'

repo owner

Positional arguments

body

  • default: '@-'

data: @- (stdin), @filename (file), string