Set-GitHubPullRequestMergeAsync
SYNOPSIS
Merge a pull request asynchronously
SYNTAX
__AllParameterSets
Set-GitHubPullRequestMergeAsync [-Owner] <string> [-Repo] <string> [-PullNumber] <long>
[-CommitTitle <string>] [-CommitMessage <string>] [-Sha <string>] [-MergeMethod <string>]
[-MergeAction <string>] [-BypassRules] [-Body <Object>] [-Accept <string>] [-WhatIf] [-Confirm]
ALIASES
This cmdlet has the following aliases,
- Get-GHSetPullRequestMergeAsync
DESCRIPTION
The Set-GitHubPullRequestMergeAsync cmdlet invokes the PUT method of the /repos/{owner}/{repo}/pulls/{pull_number}/merge-async endpoint (Merge a pull request asynchronously)
Merges a pull request into the base branch in the background or adds it to a merge queue. Background processing allows certain types of errors to be retried and reduces the risk of timeouts for complex merges.
This is the required API for merging stacked pull requests. For a stacked pull request, the operation includes all open downstack pull requests.
A new asynchronous merge request returns a ‘202’ response with a UUID that can be used to fetch the result of the merge (https://docs.github.com/rest/pulls/pulls#get-the-result-of-an-asynchronous-merge). If another asynchronous merge request is already pending for this pull request, a ‘409’ response returns that request’s UUID and merge options instead.
If the pull request is already merged or already in a merge queue, a ‘200’ response is returned immediately. A ‘merged’ result includes the merge commit OID. An ‘enqueued’ result means the pull request was added to the merge queue, not that it has merged.
If the pull request cannot be merged (e.g. because it is closed, or still a draft) this result will be returned immediately with a ‘400’ response status. Branch protection rules and repository rules are not run at this stage, only basic pull request state checks are performed.
Endpoint: PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async API version: 2026-03-10
EXAMPLES
EXAMPLE 1
Set-GitHubPullRequestMergeAsync -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1
Invokes PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async
EXAMPLE 2
Set-GitHubPullRequestMergeAsync -Owner 'octocat' -Repo 'Hello-World' -PullNumber 1 -Body @{ commit_title = 'Fix race condition' }
Sends the request body from a hashtable, parameters override the keys of -Body
PARAMETERS
-Accept
The Accept header (media type) of the request Default value: application/vnd.github+json
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Body
The whole request body as a hashtable or object. Keys that are also available as parameters are overwritten by the parameter values
Type: System.Object
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-BypassRules
Whether to bypass repository rules that the authenticated actor is permitted to bypass.
Body property [ bypass_rules ]
Type: System.Management.Automation.SwitchParameter
DefaultValue: False
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-CommitMessage
Extra detail to append to automatic commit message. Only supported for direct merges.
Body property [ commit_message ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-CommitTitle
Title for the automatic commit message. Only supported for direct merges.
Body property [ commit_title ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- cf
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MergeAction
The action that will be taken to merge the pull request. ‘direct_merge’ merges the pull request directly without using a merge queue; ‘merge_queue’ adds the pull request to a merge queue; ‘default’ uses a merge queue if one is configured for the target branch, or merges directly otherwise. If omitted, defaults to ‘default’.
Body property [ merge_action ]
Allowed values: ‘default’, ‘direct_merge’, ‘merge_queue’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-MergeMethod
The merge method to use for a direct merge. Only supported for direct merges.
Body property [ merge_method ]
Allowed values: ‘merge’, ‘squash’, ‘rebase’
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Owner
The account owner of the repository. The name is not case sensitive.
Path parameter [ owner ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-PullNumber
The number that identifies the pull request.
Path parameter [ pull_number ]
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 2
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Repo
The name of the repository without the ‘.git’ extension. The name is not case sensitive.
Path parameter [ repo ]
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 1
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-Sha
SHA that pull request head must match to allow merge. If not provided, the current head of the PR at the time of the request will be used; if the PR is pushed in between the merge being requested and being executed, the merge will be cancelled.
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-WhatIf
Runs the command in a mode that only reports what would happen without performing the actions.
Type: System.Management.Automation.SwitchParameter
DefaultValue: ''
SupportsWildcards: false
Aliases:
- wi
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Objects with properties named like the path parameters can be piped to this function
{{ Fill in the Description }}
System.String
{{ Fill in the Description }}
System.Int64
{{ Fill in the Description }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: pulls/merge-async Category: pulls / pulls