Skip to content

Commit 84b3a85

Browse files
committed
stacked webhook event
1 parent 898c2dc commit 84b3a85

1 file changed

Lines changed: 50 additions & 1 deletion

File tree

docs/src/content/docs/reference/webhooks.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: Webhooks
3-
description: Reference for the stack object in pull_request webhook event payloads.
3+
description: Reference for the stacked action and stack object in pull_request webhook event payloads.
44
---
55

66
When a pull request belongs to a stack, GitHub adds a `stack` property to the `pull_request` object in webhook event payloads. This lets apps and integrations inspect the stack's ultimate target branch — not just the direct parent branch of the PR.
@@ -52,6 +52,55 @@ The `stack` object is nested inside the `pull_request` object. It identifies the
5252

5353
The `stack` object is **only present** when the pull request belongs to a stack. For standalone PRs, the field is null.
5454

55+
## The `stacked` Event
56+
57+
GitHub delivers the `pull_request` event with the `stacked` action when a pull request is **added to a stack**. Because a PR is created before it joins a stack, this is the event to listen for when you need to know exactly when a PR becomes part of a stack.
58+
59+
| | |
60+
|---|---|
61+
| **Event** (`X-GitHub-Event` header) | `pull_request` |
62+
| **Action** | `stacked` |
63+
| **Fires when** | A pull request is added to a stack |
64+
65+
The `stacked` payload surfaces the joined stack as a **top-level `stack` object**, in addition to the `stack` nested under `pull_request`. The two objects use the same [fields](#fields) and always match, so you can read either one.
66+
67+
```json
68+
{
69+
"action": "stacked",
70+
"number": 42,
71+
"stack": {
72+
"id": 123456,
73+
"number": 50,
74+
"size": 5,
75+
"position": 2,
76+
"base": {
77+
"ref": "main",
78+
"sha": "def456..."
79+
}
80+
},
81+
"pull_request": {
82+
"number": 42,
83+
"title": "Add API routes",
84+
"base": {
85+
"ref": "feat/auth-layer",
86+
"sha": "abc123..."
87+
},
88+
"stack": {
89+
"id": 123456,
90+
"number": 50,
91+
"size": 5,
92+
"position": 2,
93+
"base": {
94+
"ref": "main",
95+
"sha": "def456..."
96+
}
97+
}
98+
}
99+
}
100+
```
101+
102+
The top-level `stack` object is unique to the `stacked` event; other `pull_request` actions (such as `opened` or `synchronize`) only carry the `stack` nested inside `pull_request`.
103+
55104
## GitHub Actions
56105

57106
GitHub Actions automatically evaluates workflow triggers using the stack's base branch. If a PR is part of a stack targeting `main`, any workflow configured to run on pull requests targeting `main` will run for every PR in the stack — no workflow changes are required.

0 commit comments

Comments
 (0)