Skip to content

Async merge API docs - #321

Open
skarim wants to merge 1 commit into
skarim/merge-cmdfrom
skarim/docs-merge-api
Open

Async merge API docs#321
skarim wants to merge 1 commit into
skarim/merge-cmdfrom
skarim/docs-merge-api

Conversation

@skarim

@skarim skarim commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Adds a Merge API reference page documenting the asynchronous merge endpoints used to land stacked PRs (PUT / GET .../pulls/{n}/merge-async): the submit → poll flow, request parameters, response statuses (pending / merged / enqueued / failed), and current limitations.

  • New reference/merge-api.md page, added to the docs sidebar
  • FAQ entry on merging a stack programmatically
  • Cross-link from the gh stack merge CLI reference

Stack created with GitHub Stacks CLIGive Feedback 💬

@skarim
skarim marked this pull request as ready for review July 28, 2026 21:09
Copilot AI review requested due to automatic review settings July 28, 2026 21:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation for programmatic asynchronous stack merging.

Changes:

  • Documents submit/poll endpoints, statuses, and limitations.
  • Adds FAQ and CLI cross-links.
  • Registers the page in the sidebar.
Show a summary per file
File Description
docs/astro.config.mjs Adds Merge API navigation.
docs/src/content/docs/faq.md Adds programmatic merge guidance.
docs/src/content/docs/reference/cli.md Links CLI merging to the API.
docs/src/content/docs/reference/merge-api.md Adds the API reference.

Review details

Comments suppressed due to low confidence (3)

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

  • The response table omits 422 Unprocessable Entity, even though the async client explicitly handles and tests that validation response (internal/github/merge_async_test.go:98-101). Document it so callers know invalid request fields or enum values produce the standard validation error rather than a {status, details} result.
| `400 Bad Request` | The pull request is not ready to be merged (for example, it is closed or a draft). | `failed` |
| `404 Not Found` | Async merge is not available for this repository, or the pull request was not found. | — |

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

  • default is not a resolved action—it asks the server to choose between direct merge and merge queue—and the pending examples show that value being echoed unchanged. Calling this field “resolved” contradicts the request-field description and may lead clients to treat default as an actual routing outcome.
| `merge_action` | `string` | `pending` | The resolved action (`default`, `direct_merge`, or `merge_queue`). |

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

  • This endpoint does not unconditionally return a UUID: the 200 merged response documented below is terminal and has only details.sha. Qualify this sentence so consumers do not reject a valid immediate result or attempt to poll without an identifier.
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.
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Medium

| Body field | Type | Description |
|------------|------|-------------|
| `merge_method` | `string` | The merge method: `merge`, `squash`, or `rebase`. Defaults to a merge commit. |
| `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. |
Comment on lines +18 to +19
1. **Submit** a merge request with `PUT .../merge-async`. The response contains a `uuid` identifying the request.
2. **Poll** for the result with `GET .../merge-async/{uuid}` until the `status` is no longer `pending`.
@skarim
skarim force-pushed the skarim/docs-merge-api branch from 28e19d9 to 40aa300 Compare July 28, 2026 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants