Note
This feature is in public preview and subject to change.
The GitHub REST and GraphQL APIs both expose stacked pull requests. The REST API supports reading and managing stacks, while the GraphQL API supports read-only queries.
Use the API to read a pull request's stack membership or to build your own automation and integrations for stacked pull requests.
REST API
The REST API exposes stacked pull requests in two ways:
- The
stackobject on pull request resources. When a pull request belongs to a stack, its REST resource includes astackobject. This lets you read the pull request's stack membership, including the stack's number and size and the pull request's position and base, directly from the pull request. - The Stacks API. A dedicated set of endpoints to list, read, create, extend, and dissolve stacks. This is the surface for creating and modifying stacks.
Note
If you merge via the API and want to use stacked pull requests, you'll need to update your code to use the new merge API for stacks.
For endpoints, parameters, and schemas, see REST API endpoints for pull requests.
GraphQL API
The GraphQL API exposes a pull request's stack membership through read-only stack and stackEntry fields on the PullRequest type. Use these fields to query the stack a pull request belongs to and its position within it.
The GraphQL API is read-only for stacks; there are no stack mutations. To create or modify stacks, use the REST API.
For fields, objects, and schemas, see Pull requests.