Skip to content

docs: stack object in pull_request webhooks#67

Merged
skarim merged 4 commits intomainfrom
copilot/update-docs-stack-details
May 4, 2026
Merged

docs: stack object in pull_request webhooks#67
skarim merged 4 commits intomainfrom
copilot/update-docs-stack-details

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 24, 2026

pull_request webhook events now include a stack object for PRs that belong to a stack. Without documentation, teams can't easily discover how to use stack.base.ref to trigger CI on every PR in a stack targeting main — not just the bottom PR that directly targets main.

Changes

  • New guide docs/src/content/docs/guides/ci-integration.md:

    • Documents the stack object shape in pull_request webhook payloads
    • Distinguishes pull_request.base.ref (direct PR base) from pull_request.stack.base.ref (ultimate stack target)
    • GitHub Actions if condition example covering both stacked and standalone PRs
    • JavaScript and Python webhook handler snippets with safe optional chaining for non-stacked PRs
    • Use cases for stack.base.sha (drift detection, targeted git log, CI caching)
    • Reference table mapping all four PR scenarios (standalone, bottom, mid-stack, top) to their field values
  • docs/astro.config.mjs: Adds the new guide to the sidebar under Guides.

Key pattern documented

# GitHub Actions: run on any PR that ultimately targets main
if: |
  github.event.pull_request.base.ref == 'main' ||
  github.event.pull_request.stack.base.ref == 'main'
// Custom webhook handler — stack is absent for standalone PRs
const targetsMain =
  pr.base.ref === 'main' || pr.stack?.base?.ref === 'main';

…hook events

Agent-Logs-Url: https://github.com/github/gh-stack/sessions/cf10db22-af0b-45c3-95d6-de9ef313d624

Co-authored-by: willsmythe <2503052+willsmythe@users.noreply.github.com>
Copilot AI changed the title [WIP] Update docs with stack details in pull request webhook event docs: Add CI/webhook integration guide for stack PRs Apr 24, 2026
Copilot AI requested a review from willsmythe April 24, 2026 20:34
@skarim skarim marked this pull request as ready for review May 4, 2026 05:05
@skarim skarim self-requested a review as a code owner May 4, 2026 05:05
Copilot AI review requested due to automatic review settings May 4, 2026 05:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 the pull_request.stack object surfaced in pull_request webhook payloads and links it from the docs sidebar, plus an FAQ entry showing how to access this data in GitHub Actions workflows.

Changes:

  • Adds a new Webhooks reference page documenting the pull_request.stack.base.{ref,sha} fields.
  • Extends the FAQ with a GitHub Actions snippet and a small reference table for github.event.pull_request.stack.
  • Updates the docs sidebar to include the new Webhooks reference page.
Show a summary per file
File Description
docs/src/content/docs/reference/webhooks.md New reference page explaining the stack object in pull_request webhook payloads and how it relates to Actions.
docs/src/content/docs/faq.md Adds an FAQ section showing how to read pull_request.stack in GitHub Actions expressions.
docs/astro.config.mjs Adds “Webhooks” to the Reference sidebar.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comments suppressed due to low confidence (1)

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

  • This is internally inconsistent: it says the stack object is only present when the PR belongs to a stack, but then says for standalone PRs the field is null. For JSON webhook payloads, either document that the property is omitted/absent for standalone PRs, or (if it really is present) show it explicitly as "stack": null in the example payload.
The `stack` object is **only present** when the pull request belongs to a stack. For standalone PRs, the field is null.
  • Files reviewed: 3/3 changed files
  • Comments generated: 3

Comment thread docs/src/content/docs/faq.md Outdated
Comment thread docs/astro.config.mjs
Comment thread docs/src/content/docs/reference/webhooks.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@skarim skarim changed the title docs: Add CI/webhook integration guide for stack PRs docs: stack object in pull_request webhooks May 4, 2026
@skarim skarim merged commit ad56830 into main May 4, 2026
6 checks passed
@skarim skarim deleted the copilot/update-docs-stack-details branch May 4, 2026 05:14
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.

Update docs with details about stack details in pull_request webhook event

4 participants