< Back

New-GitHubPullRequest

Sat Jan 18, 2020 9:39 pm

NAME New-GitHubPullRequest



SYNOPSIS

Create a new pull request in the specified repository.





SYNTAX

New-GitHubPullRequest [-OwnerName <String>] [-RepositoryName <String>] -Title <String> [-Body <String>] -Head

<String> -Base <String> [-HeadOwner <String>] [-MaintainerCanModify] [-Draft] [-AccessToken <String>] [-NoStatus]

[-WhatIf] [-Confirm] [<CommonParameters>]



New-GitHubPullRequest [-OwnerName <String>] [-RepositoryName <String>] -Issue <Int32> -Head <String> -Base

<String> [-HeadOwner <String>] [-MaintainerCanModify] [-Draft] [-AccessToken <String>] [-NoStatus] [-WhatIf]

[-Confirm] [<CommonParameters>]



New-GitHubPullRequest -Uri <String> -Issue <Int32> -Head <String> -Base <String> [-HeadOwner <String>]

[-MaintainerCanModify] [-Draft] [-AccessToken <String>] [-NoStatus] [-WhatIf] [-Confirm] [<CommonParameters>]



New-GitHubPullRequest -Uri <String> -Title <String> [-Body <String>] -Head <String> -Base <String> [-HeadOwner

<String>] [-MaintainerCanModify] [-Draft] [-AccessToken <String>] [-NoStatus] [-WhatIf] [-Confirm]

[<CommonParameters>]





DESCRIPTION

Opens a new pull request from the given branch into the given branch in the specified repository.



The Git repo for this module can be found here: http://aka.ms/PowerShellForGitHub





PARAMETERS

-OwnerName <String>

Owner of the repository.

If not supplied here, the DefaultOwnerName configuration property value will be used.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-RepositoryName <String>

Name of the repository.

If not supplied here, the DefaultRepositoryName configuration property value will be used.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Uri <String>

Uri for the repository.

The OwnerName and RepositoryName will be extracted from here instead of needing to provide

them individually.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Title <String>

The title of the pull request to be created.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Body <String>

The text description of the pull request.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Issue <Int32>

The GitHub issue number to open the pull request to address.



Required? true

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-Head <String>

The name of the head branch (the branch containing the changes to be merged).



May also include the name of the owner fork, in the form "${fork}:${branch}".



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Base <String>

The name of the target branch of the pull request

(where the changes in the head will be merged to).



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HeadOwner <String>

The name of fork that the change is coming from.



Used as the prefix of $Head parameter in the form "${HeadOwner}:${Head}".



If unspecified, the unprefixed branch name is used,

creating a pull request from the $OwnerName fork of the repository.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-MaintainerCanModify [<SwitchParameter>]

If set, allows repository maintainers to commit changes to the

head branch of this pull request.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Draft [<SwitchParameter>]

If set, opens the pull request as a draft.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-AccessToken <String>

If provided, this will be used as the AccessToken for authentication with the

REST Api. Otherwise, will attempt to use the configured value or will run unauthenticated.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-NoStatus [<SwitchParameter>]

If this switch is specified, long-running commands will run on the main thread

with no commandline status update. When not specified, those commands run in

the background, enabling the command prompt to provide status information.

If not supplied here, the DefaultNoStatus configuration property value will be used.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

[PSCustomObject] An object describing the created pull request.





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$prParams = @{



OwnerName = 'Microsoft'

Repository = 'PowerShellForGitHub'

Title = 'Add simple file to root'

Head = 'octocat:simple-file'

Base = 'master'

Body = "Adds a simple text file to the repository root.`n`nThis is an automated PR!"

MaintainerCanModify = $true

}

$pr = New-GitHubPullRequest @prParams









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>New-GitHubPullRequest -Uri 'https://github.com/PowerShell/PSScriptAnalyzer' -Title 'Add test' -Head

simple-test -HeadOwner octocat -Base development -Draft -MaintainerCanModify













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>New-GitHubPullRequest -Uri 'https://github.com/PowerShell/PSScriptAnalyzer' -Issue 642 -Head simple-test

-HeadOwner octocat -Base development -Draft















RELATED LINKS