Skip to main content

pull_request_async_merges

Creates, updates, deletes, gets or lists a pull_request_async_merges resource.

Overview

Namepull_request_async_merges
TypeResource
Idgithub.pulls.pull_request_async_merges

Fields

The following fields are returned by SELECT queries:

the current result of the asynchronous merge request

NameDatatypeDescription
detailsobjectWhen an asynchronous merge request was created or already existed
statusstring (pending, merged, enqueued, failed)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_merge_async_resultselectowner, repo, pull_number, uuidFetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested.

While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure.

The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a 404 response for its UUID.
merge_asyncexecowner, repo, pull_numberMerges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges.

This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch.

The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used.

If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status.

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.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
ownerstringThe account owner of the repository. The name is not case sensitive.
pull_numberintegerThe number that identifies the pull request.
repostringThe name of the repository without the .git extension. The name is not case sensitive.
uuidstringThe UUID of the asynchronous merge request, as returned when the merge was requested.

SELECT examples

Fetches the current result of an asynchronous merge request, identified by the UUID that was returned when the merge was requested.

While the merge is still queued, the response includes the UUID, merge method, and expected head SHA of the request. Once the merge has completed, the response reports whether it was merged, including the merge commit OID on success or a message describing why it could not be merged on failure.

The result of an asynchronous merge request is retained for 24 hours after its most recent update. After this window the request expires and this endpoint returns a 404 response for its UUID.

SELECT
details,
status
FROM github.pulls.pull_request_async_merges
WHERE owner = '{{ owner }}' -- required
AND repo = '{{ repo }}' -- required
AND pull_number = '{{ pull_number }}' -- required
AND uuid = '{{ uuid }}' -- required
;

Lifecycle Methods

Merges a pull request into the base branch in the background. Merging in this way allows certain types of errors to be retried, and avoids the risk of timeouts for particularly complex merges.

This is the required method for merging stacked PRs, but also supports unstacked PRs. When using this endpoint to merge a stacked pull request, all pull requests in the stack up to and including the requested PR will be merged into the base branch.

The response includes a UUID that can be used to fetch the result of the merge. If another asynchronous merge request has already been made for this pull request, the UUID of that request will be returned instead with a 409 response status to indicate that the merge options may be different from those that were requested. If there isn't an existing asynchronous merge request, a 202 response status is used.

If the pull request is already merged, the merge commit OID will be returned immediately with a 200 status.

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.

EXEC github.pulls.pull_request_async_merges.merge_async 
@owner='{{ owner }}' --required,
@repo='{{ repo }}' --required,
@pull_number='{{ pull_number }}' --required
@@json=
'{
"commit_title": "{{ commit_title }}",
"commit_message": "{{ commit_message }}",
"sha": "{{ sha }}",
"merge_method": "{{ merge_method }}",
"merge_action": "{{ merge_action }}"
}'
;