Skip to content

Commit 7b813bc

Browse files
updating merge api and adding webhooks to programmatic reference (#62621)
Co-authored-by: Vanessa <vgrl@github.com>
1 parent 45c2ecd commit 7b813bc

7 files changed

Lines changed: 35 additions & 15 deletions

File tree

content/pull-requests/get-started/about-stacked-prs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ You can merge your entire stack, a single pull request, or a portion of the stac
113113
Stacks support merge commit, squash, and rebase merge methods, and they are merge-queue aware. The resulting commit history is the same as merging each pull request individually, starting from the bottom.
114114

115115
> [!NOTE]
116-
> If you merge via the API and want to use stacked pull requests, you'll need to update to use the new merge API for stacks. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
116+
> If you merge via the API and want to use stacked pull requests, you'll need to use the asynchronous merge API for stacks. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
117117
118118
## Next steps
119119

content/pull-requests/how-tos/merge-and-close-pull-requests/merging-stacked-pull-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The merge box for a stacked pull request shows the status of the entire stack, n
2727
If the stack is not linear, for example, after changes were pushed to a lower branch or after the trunk moved ahead, a **Rebase stack** button will appear in the merge box and you'll need to rebase the stack before you can merge.
2828

2929
> [!NOTE]
30-
> * 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. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
30+
> * If you merge via the API and want to use stacked pull requests, you'll need use the asynchronous merge API for stacks. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
3131
> * Auto-merge is not supported for stacked pull requests.
3232
3333
## Merging using a merge queue

content/pull-requests/how-tos/stacked-pull-requests/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ children:
2323
- /content/pull-requests/tutorials/stack-code-changes-in-pull-requests
2424
- /content/pull-requests/reference/stacked-pull-requests
2525
- /content/pull-requests/reference/stacked-prs-cli-commands
26-
- /content/pull-requests/reference/stacked-pull-requests-rest-and-graphql-apis
26+
- /content/pull-requests/reference/stacked-pull-requests-apis-and-webhooks
2727
- /content/rest/pulls/pulls
2828
- /content/graphql/reference/pulls
2929
- /content/webhooks/webhook-events-and-payloads

content/pull-requests/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@ redirect_from:
99
- /categories/collaborating-on-projects-using-issues-and-pull-requests
1010
- /categories/collaborating-with-issues-and-pull-requests
1111
- /github/collaborating-with-pull-requests
12-
intro: 'Discover how to create, review, and merge pull requests, resolve merge conflicts, and collaborate effectively on {% data variables.product.github %} projects.'
12+
intro: 'Discover how to create, review, and merge pull requests, resolve merge conflicts, and work with forks.'
1313
introLinks:
1414
overview: /pull-requests/get-started/about-pull-requests
1515
layout: discovery-landing
1616
carousels:
1717
recommended:
18-
- /pull-requests/reference/pull-requests
18+
- /pull-requests/get-started/about-pull-requests
1919
- /pull-requests/reference/branches
2020
- /pull-requests/how-tos/create-pull-requests/creating-a-pull-request
2121
- /pull-requests/how-tos/review-pull-requests/reviewing-proposed-changes-in-a-pull-request
2222
- /pull-requests/how-tos/merge-and-close-pull-requests/merging-a-pull-request
2323
- /pull-requests/how-tos/merge-and-close-pull-requests/resolving-a-merge-conflict-on-github
2424
- /pull-requests/how-tos/work-with-forks/fork-a-repo
25-
- /pull-requests/how-tos/work-with-forks/syncing-a-fork
2625
- /pull-requests/reference/commits
2726
includedCategories:
2827
- Create pull requests

content/pull-requests/reference/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ children:
1010
- /pull-requests
1111
- /stacked-pull-requests
1212
- /stacked-prs-cli-commands
13-
- /stacked-pull-requests-rest-and-graphql-apis
13+
- /stacked-pull-requests-apis-and-webhooks
1414
- /branches
1515
- /forks
1616
- /commits

content/pull-requests/reference/stacked-pull-requests-rest-and-graphql-apis.md renamed to content/pull-requests/reference/stacked-pull-requests-apis-and-webhooks.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
---
2-
title: Stacked pull requests in the REST and GraphQL APIs
3-
shortTitle: Stacked PRs APIs
4-
intro: Read and manage stacked pull requests programmatically with the {% data variables.product.github %} REST and GraphQL APIs.
2+
title: Stacked pull requests APIs and webhooks
3+
shortTitle: Stacked PRs APIs and webhooks
4+
intro: Read and manage stacked pull requests programmatically with the {% data variables.product.github %} REST and GraphQL APIs, and webhooks.
55
allowTitleToDifferFromFilename: true
6+
redirect_from:
7+
- /pull-requests/reference/stacked-pull-requests-rest-and-graphql-apis
68
versions:
79
feature: pr-stacks
810
contentType: reference
911
category:
1012
- Create pull requests
13+
- Merge and close pull requests
1114
---
1215

1316
{% data reusables.public-preview.public-preview %}
@@ -23,11 +26,21 @@ The REST API exposes stacked pull requests in two ways:
2326
* **The `stack` object on pull request resources.** When a pull request belongs to a stack, its REST resource includes a `stack` object. 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.
2427
* **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.
2528

26-
> [!NOTE]
27-
> 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. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
28-
2929
For endpoints, parameters, and schemas, see [AUTOTITLE](/rest/pulls/pulls).
3030

31+
> [!IMPORTANT]
32+
> If you merge via the API and want to use stacked pull requests, you must use the new asynchronous merge API.
33+
34+
### Merge API
35+
36+
When you merge a stacked pull request via the API, you must use the asynchronous merge endpoint.
37+
38+
A stack cannot be merged with the legacy synchronous merge endpoints or mutations. When you merge a stacked pull request, every pull request in the stack up to and including the one you request is merged or queued to merge into the base branch. Merging a pull request stack may involve several pull requests that may take a few minutes to merge. Because of this, the merge runs in the background when you submit a merge request and then you can poll for the result.
39+
40+
Only the basic pull request state is checked when you submit an open PR. 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, meaning either the whole group of pull requests merges, or is added to the merge queue, or none of it is.
41+
42+
For details, see [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
43+
3144
## GraphQL API
3245

3346
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.
@@ -36,6 +49,14 @@ The GraphQL API is read-only for stacks; there are no stack mutations. To create
3649

3750
For fields, objects, and schemas, see [AUTOTITLE](/graphql/reference/pulls#object-pullrequeststack).
3851

52+
## Webhooks
53+
54+
When a pull request belongs to a stack, {% data variables.product.github %} adds a `stack` property to the `pull_request` object in webhook event payloads. This lets apps and integrations inspect the stack's target branch, not just the direct parent branch of the pull request.
55+
56+
The `stack` object is included in the `pull_request` webhook payload for pull request lifecycle events that happen while the pull request is part of a stack.
57+
58+
See [AUTOTITLE](/webhooks/webhook-events-and-payloads?actionType=stacked#pull_request).
59+
3960
## Further reading
4061

4162
* [AUTOTITLE](/pull-requests/reference/stacked-prs-cli-commands)

content/pull-requests/tutorials/roll-out-stacked-prs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,11 @@ To sustain adoption, review any in-house tools, bots, or dashboards that create,
6767
If your organization provides an internal CLI or other developer tooling, you can use the Stacks API to integrate stack creation and management into those existing tools instead of requiring developers to adopt `gh stack`.
6868

6969
> [!IMPORTANT]
70-
> Merging a stacked pull request programmatically requires the asynchronous merge API, which supports both stacked and standalone pull requests. The legacy pull request merge endpoint can't merge a stack. If your organization merges pull requests programmatically, update that tooling to use the asynchronous merge API before rolling out stacked pull requests. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
70+
> Merging a stacked pull request requires the asynchronous merge API. The legacy pull request merge endpoints can't merge a stack. If your organization merges pull requests programmatically, for example, through in-house tooling or ChatOps bots, update that tooling to call the asynchronous merge API, which supports both stacked and regular pull requests, before rolling out stacked pull requests. See [AUTOTITLE](/rest/pulls/pulls?apiVersion=2026-03-10#merge-a-pull-request-asynchronously).
7171
7272
You may also want to track stack activity programmatically, for example, across dashboards, bots, or internal tooling.
7373

74-
* **REST API**: Every pull request returned by the API includes a `stack` object when it belongs to a stack, showing the stack's number, size, the pull request's position within it, and the stack's base branch. A dedicated Stacks API (`GET /repos/{owner}/{repo}/stacks`) also lists every stack in a repository, or the specific stack containing a given pull request. See [AUTOTITLE](/pull-requests/reference/stacked-pull-requests-rest-and-graphql-apis).
74+
* **REST API**: Every pull request returned by the API includes a `stack` object when it belongs to a stack, showing the stack's number, size, the pull request's position within it, and the stack's base branch. A dedicated Stacks API (`GET /repos/{owner}/{repo}/stacks`) also lists every stack in a repository, or the specific stack containing a given pull request. See [AUTOTITLE](/pull-requests/reference/stacked-pull-requests-apis-and-webhooks).
7575
* **Webhooks**: The `pull_request` webhook payload includes the same `stack` object whenever a pull request belongs to a stack. A dedicated `stacked` action fires when a pull request is first added to a stack, so you can react the moment a stack forms.
7676

7777
In both cases, the `stack` field is `null` for standalone pull requests, so existing integrations that don't expect stacks continue to work unchanged.

0 commit comments

Comments
 (0)