Skip to content

Commit d32890d

Browse files
committed
address review comments
1 parent 1ea79f7 commit d32890d

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

docs/src/content/docs/reference/merge-api.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@ Stacked pull requests are merged through a new **asynchronous merge API**. Becau
77

88
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.
99

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-
1410
## How it works
1511

1612
Merging is a two-step flow:
1713

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`.
2016

2117
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.
2218

@@ -26,14 +22,14 @@ Only basic pull request state is checked when you submit (the PR must be open an
2622
PUT /repos/{owner}/{repo}/pulls/{pull_number}/merge-async
2723
```
2824

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).
3026

3127
All body fields are optional.
3228

3329
| Body field | Type | Description |
3430
|------------|------|-------------|
3531
| `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`. |
3733
| `commit_title` | `string` | Title for the automatic commit message. Not supported on `merge_queue` merge actions. |
3834
| `commit_message` | `string` | Extra detail to append to the automatic commit message. Not supported on `merge_queue` merge actions. |
3935
| `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. |
@@ -52,6 +48,7 @@ echo '{"merge_method": "squash", "merge_action": "default"}' | \
5248
| `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` |
5349
| `400 Bad Request` | The pull request is not ready to be merged (for example, it is closed or a draft). | `failed` |
5450
| `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). ||
5552

5653
```json
5754
// 202 Accepted
@@ -147,7 +144,7 @@ The fields present in `details` depend on the state:
147144
| `message` | `string` | always | A human-readable description of the current state. |
148145
| `uuid` | `string` | `pending` | The identifier of the merge request, used to poll for the result. |
149146
| `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`). |
151148
| `expected_head_sha` | `string` | `pending` | The SHA the pull request head must match for the merge to proceed. |
152149
| `sha` | `string` | `merged` | The resulting merge commit SHA. |
153150

0 commit comments

Comments
 (0)