Skip to content

feat: Add Stack field to PullRequest for stacked pull requests - #4423

Merged
gmlewis merged 4 commits into
google:masterfrom
joeljeske:feat/stacked-prs
Jul 31, 2026
Merged

feat: Add Stack field to PullRequest for stacked pull requests#4423
gmlewis merged 4 commits into
google:masterfrom
joeljeske:feat/stacked-prs

Conversation

@joeljeske

@joeljeskejoeljeske commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

GitHub's REST API and pull_request webhook payloads now include a stack
object on pull requests that belong to a stack (stacked pull requests). It
reports the branch the whole stack ultimately targets, which can differ from the
PR's own base branch. go-github didn't expose it.

This adds PullRequest.Stack and a PullRequestStack type
(id, number, base, size, position). Because webhook events reuse the
PullRequest struct (PullRequestEvent.PullRequest), the field is available for
both REST responses and incoming pull_request webhooks.

Accessors and stringify tests were regenerated via go generate ./....

Ref: pull request schema in the REST API docs
(https://docs.github.com/en/rest/pulls/pulls), which documents the stack
object.

@gmlewisgmlewis changed the title feat(stacks) Add Stack field to PullRequest for stacked pull requestsfeat: Add Stack field to PullRequest for stacked pull requestsJul 29, 2026
@gmlewisgmlewis added the NeedsReview PR is awaiting a review before merging. label Jul 29, 2026
@codecov

codecovBot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.54%. Comparing base (34349a8) to head (d2ff87e).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #4423 +/- ##
=======================================
Coverage 97.54% 97.54% =======================================
Files 194 194 Lines 19765 19765 =======================================
Hits 19279 19279 Misses 268 268 Partials 218 218 

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewisgmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @joeljeske!
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.

cc: @stevehipwell - @alexandear - @Not-Dhananjay-Mishra

@joeljeske

Copy link
Copy Markdown
ContributorAuthor

Friendly bump @stevehipwell - @alexandear - @Not-Dhananjay-Mishra
This feature is now public, not in private preview anymore: https://github.blog/changelog/2026-07-30-stacked-pull-requests-are-now-in-public-preview/

@Not-Dhananjay-MishraNot-Dhananjay-Mishra left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few nits, otherwise LGTM.
Apologies for the delay 🫠.

Comment threadgithub/pulls.go Outdated
Comment threadgithub/pulls.go Outdated
Co-authored-by: Dhananjay Mishra <technicaldmcontact@gmail.com>
@joeljeske

Copy link
Copy Markdown
ContributorAuthor

Thank you @Not-Dhananjay-Mishra great find - completely agree! I applied your suggestions here.

@Not-Dhananjay-Mishra

Copy link
Copy Markdown
Contributor

Thanks @joeljeske. One more thing, you'll need to run go generate ./... on your machine then push the changes, as currently the generated files are out of date.

@joeljeske

Copy link
Copy Markdown
ContributorAuthor

Ah thanks @Not-Dhananjay-Mishra. Done!

@gmlewis
gmlewis merged commit 248317c into google:masterJul 31, 2026
15 checks passed
@gmlewisgmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 31, 2026
Sign up for freeto 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.

3 participants

@joeljeske@Not-Dhananjay-Mishra@gmlewis