You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/merge-api.md
+6-9Lines changed: 6 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,16 +7,12 @@ Stacked pull requests are merged through a new **asynchronous merge API**. Becau
7
7
8
8
This is the **required method for merging stacked PRs**. A stack cannot be merged with the legacy synchronous [merge endpoints](https://docs.github.com/rest/pulls/pulls#merge-a-pull-request) or [mutations](https://docs.github.com/en/graphql/reference/pulls#mutation-mergepullrequest). When you merge a stacked pull request, every pull request in the stack up to and including the one you request is merged into the base branch.
9
9
10
-
:::caution[Private Preview]
11
-
Stacked PRs is currently in private preview. These endpoints are only available for repositories where the feature is enabled. [Sign up for the waitlist →](https://gh.io/stacksbeta)
12
-
:::
13
-
14
10
## How it works
15
11
16
12
Merging is a two-step flow:
17
13
18
-
1.**Submit** a merge request with `PUT .../merge-async`. The response contains a `uuid`identifying the request.
19
-
2.**Poll** for the result with `GET .../merge-async/{uuid}` until the `status` is no longer `pending`.
14
+
1.**Submit** a merge request with `PUT .../merge-async`, then read the `status`. Only a `pending`response includes a `uuid`to poll. The submit can also resolve immediately to `merged` (the pull request was already merged) or `failed` (the pull request is closed or a draft), both of which are terminal.
15
+
2.**Poll**a `pending` request for its result with `GET .../merge-async/{uuid}` until the `status` is no longer `pending`.
20
16
21
17
Only basic pull request state is checked when you submit (the PR must be open and not a draft). Branch protection and repository rules are evaluated later, when the merge actually runs, and a rule failure is reported as a `failed` result while polling. A stack merge request is **atomic**: either the whole group of pull requests lands (or is added to the merge queue), or none of it does.
22
18
@@ -26,14 +22,14 @@ Only basic pull request state is checked when you submit (the PR must be open an
26
22
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async
27
23
```
28
24
29
-
Merges the pull request (and, for a stacked PR, everything below it in the stack) into the base branch in the background. Returns a `uuid` used to fetch the result.
25
+
Merges the pull request (and, for a stacked PR, everything below it in the stack) into the base branch in the background. Only a `pending` response returns a `uuid`to fetch the result. The submit can also resolve immediately — `merged` if the pull request was already merged, or `failed` if it cannot be merged (for example, it is closed or a draft).
30
26
31
27
All body fields are optional.
32
28
33
29
| Body field | Type | Description |
34
30
|------------|------|-------------|
35
31
|`merge_method`|`string`| The merge method: `merge`, `squash`, or `rebase`. Defaults to a merge commit. |
36
-
|`merge_action`|`string`| How to merge: `default` (recommended), `direct_merge`, or `merge_queue`. `default` picks the most appropriate option — it merges directly, or adds the stack to the base branch's merge queue when the branch requires one. `direct_merge` forces a direct merge; `merge_queue` forces the merge queue, if available. |
32
+
|`merge_action`|`string`| How to merge: `default` (recommended), `direct_merge`, or `merge_queue`. `default` picks the most appropriate option — it merges directly, or adds the stack to the base branch's merge queue when the branch requires one. `direct_merge` forces a direct merge; `merge_queue` forces the merge queue, if available. Omitting this field is equivalent to `default`. |
37
33
|`commit_title`|`string`| Title for the automatic commit message. Not supported on `merge_queue` merge actions. |
38
34
|`commit_message`|`string`| Extra detail to append to the automatic commit message. Not supported on `merge_queue` merge actions. |
39
35
|`sha`|`string`| SHA that the pull request head must match to allow the merge. If the PR head does not match the provided SHA, the merge is cancelled. |
|`409 Conflict`| A merge request already exists for this pull request. The existing request's `uuid` is returned — its options may differ from those you requested. |`pending`|
53
49
|`400 Bad Request`| The pull request is not ready to be merged (for example, it is closed or a draft). |`failed`|
54
50
|`404 Not Found`| Async merge is not available for this repository, or the pull request was not found. | — |
51
+
|`422 Unprocessable Entity`| The request body failed validation (for example, an invalid `merge_method` or `merge_action` value). | — |
55
52
56
53
```json
57
54
// 202 Accepted
@@ -147,7 +144,7 @@ The fields present in `details` depend on the state:
147
144
|`message`|`string`| always | A human-readable description of the current state. |
148
145
|`uuid`|`string`|`pending`| The identifier of the merge request, used to poll for the result. |
149
146
|`merge_method`|`string`|`pending`| The merge method being used (`merge`, `squash`, or `rebase`). |
150
-
|`merge_action`|`string`|`pending`| The resolved action (`default`, `direct_merge`, or `merge_queue`). |
147
+
|`merge_action`|`string`|`pending`| The requested merge action (`default`, `direct_merge`, or `merge_queue`). |
151
148
|`expected_head_sha`|`string`|`pending`| The SHA the pull request head must match for the merge to proceed. |
152
149
|`sha`|`string`|`merged`| The resulting merge commit SHA. |
0 commit comments