feat(actions): add before/after to PR synchronize event payload (#37827)

## Summary

- Add `before` and `after` fields to `PullRequestPayload` for
`synchronize` events
- Thread push old/new commit SHAs through the PR synchronize notifier
path (regular and Agit flows)
- Populate the fields in webhook and Actions event payloads so workflows
can access them via `github.event.before` and `github.event.after`

Fixes #33395

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Nicolas
2026-05-23 20:51:03 +02:00
committed by GitHub
parent cdee9f5e10
commit c9ce7e447c
9 changed files with 75 additions and 8 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ type Notifier interface {
NewPullRequest(ctx context.Context, pr *issues_model.PullRequest, mentions []*user_model.User)
MergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest)
AutoMergePullRequest(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest)
PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest)
PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, before, after string)
PullRequestReview(ctx context.Context, pr *issues_model.PullRequest, review *issues_model.Review, comment *issues_model.Comment, mentions []*user_model.User)
PullRequestCodeComment(ctx context.Context, pr *issues_model.PullRequest, comment *issues_model.Comment, mentions []*user_model.User)
PullRequestChangeTargetBranch(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, oldBranch string)
+2 -2
View File
@@ -120,9 +120,9 @@ func NewPullRequest(ctx context.Context, pr *issues_model.PullRequest, mentions
}
// PullRequestSynchronized notifies Synchronized pull request
func PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
func PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, before, after string) {
for _, notifier := range notifiers {
notifier.PullRequestSynchronized(ctx, doer, pr)
notifier.PullRequestSynchronized(ctx, doer, pr, before, after)
}
}
+1 -1
View File
@@ -63,7 +63,7 @@ func (*NullNotifier) AutoMergePullRequest(ctx context.Context, doer *user_model.
}
// PullRequestSynchronized places a place holder function
func (*NullNotifier) PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest) {
func (*NullNotifier) PullRequestSynchronized(ctx context.Context, doer *user_model.User, pr *issues_model.PullRequest, before, after string) {
}
// PullRequestChangeTargetBranch places a place holder function