Skip to main content

GitHub async merge API generally available

By Steven Van ·

The async merge API is now GitHub's recommended way to merge pull requests programmatically, and the only one that supports stacked pull requests.

The async merge API is now generally available on GitHub. It can merge individual or stacked pull requests, add a pull request to a merge queue, or merge directly, with optional rule bypass for people who have permission.

Merges are processed in the background, so automations on busy repositories do not have to wait for a complex merge to finish in one request. Submit the request with PUT, then poll with GET using the returned request ID to check its status.

  • A new request returns a 202 with a UUID. If a request is already pending for that pull request, a 409 returns the existing UUID instead.
  • Results are pending, merged, enqueued or failed. An enqueued result means the pull request joined the merge queue, not that it has merged.
  • Results are kept for 24 hours after the last update, after which the endpoint returns a 404.
  • Branch protection and repository rules are not run when the request is accepted, only basic pull request state checks.

GitHub now recommends this as the way to merge pull requests programmatically, in place of the synchronous REST endpoint or GraphQL mutations. It is also the only merge API that supports stacked pull requests. For a stacked pull request, the merge includes all open downstack pull requests.

GitHub
GitHub
Where the world builds software — Git hosting, pull requests, issues, Actions CI/CD, and Copilot, free for public and private repos.
View GitHub →

Read the original announcement →

Read GitHub async merge API generally available on Creators Toolbox