dmitri.shuralyov.com/service/change/...

Add initial support for merged event.
dmitshur committed 2 years ago commit 4078cbd654dfe8348eb9823fceb3c310a63c6ce1
githubapi/githubapi.go
@@ -313,10 +313,13 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
 							event
 							RequestedReviewer struct {
 								githubqlActor `graphql:"...on Actor"`
 							}
 						} `graphql:"...on ReviewRequestRemovedEvent"`
+						MergedEvent struct {
+							event
+						} `graphql:"...on MergedEvent"`
 						PullRequestReview struct {
 							Author    githubqlActor
 							CreatedAt githubql.DateTime
 							State     githubql.PullRequestReviewState
 						} `graphql:"...on PullRequestReview"`
@@ -468,10 +471,13 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
 		case "ReviewRequestRemovedEvent":
 			e.Actor = ghActor(event.ReviewRequestRemovedEvent.Actor)
 			e.CreatedAt = event.ReviewRequestRemovedEvent.CreatedAt.Time
 			// TODO: Move RequestedReviewer field to changes-only events (it doesn't apply to issues).
 			e.RequestedReviewer = ghActor(event.ReviewRequestRemovedEvent.RequestedReviewer.githubqlActor)
+		case "MergedEvent":
+			e.Actor = ghActor(event.ReviewRequestRemovedEvent.Actor)
+			e.CreatedAt = event.ReviewRequestRemovedEvent.CreatedAt.Time
 		case "PullRequestReview":
 			switch event.PullRequestReview.State {
 			case githubql.PullRequestReviewStateApproved:
 				// TODO: Make this a thing that ListComments returns, etc. After all, it can have a non-empty body.
 				e.Type = "ApprovedEvent"
@@ -485,12 +491,11 @@ func (s service) ListTimeline(ctx context.Context, rs string, id uint64, opt *ch
 		}
 		timeline = append(timeline, e)
 	}
 
 	// We can't just delegate pagination to GitHub because our timeline items don't match up 1:1,
-	// we want to skip IssueComment in the timeline, etc.
-	// THINK: Or maybe they can be made to match up? Investigate.
+	// we want to skip Commit in the timeline, etc.
 	if opt != nil {
 		start := opt.Start
 		if start > len(timeline) {
 			start = len(timeline)
 		}