@@ -24,6 +24,7 @@ import (
2424 "errors"
2525 "fmt"
2626 "hash/fnv"
27+ "maps"
2728 "slices"
2829 "time"
2930
@@ -40,8 +41,10 @@ const timelineBatchSize = 100
4041// `... on MergedEvent` fragment) is a hard GraphQL validation error that aborts the
4142// whole timeline pass. issueTimelineItemTypes is the set valid on BOTH unions; the PR
4243// query adds the PR-only types on top.
43- const issueTimelineItemTypes = "CLOSED_EVENT,REOPENED_EVENT,LOCKED_EVENT,UNLOCKED_EVENT,RENAMED_TITLE_EVENT,LABELED_EVENT,UNLABELED_EVENT,MILESTONED_EVENT,DEMILESTONED_EVENT,PINNED_EVENT,UNPINNED_EVENT"
44- const prTimelineItemTypes = issueTimelineItemTypes + ",MERGED_EVENT,HEAD_REF_DELETED_EVENT,AUTO_MERGE_ENABLED_EVENT,AUTO_MERGE_DISABLED_EVENT"
44+ const (
45+ issueTimelineItemTypes = "CLOSED_EVENT,REOPENED_EVENT,LOCKED_EVENT,UNLOCKED_EVENT,RENAMED_TITLE_EVENT,LABELED_EVENT,UNLABELED_EVENT,MILESTONED_EVENT,DEMILESTONED_EVENT,PINNED_EVENT,UNPINNED_EVENT"
46+ prTimelineItemTypes = issueTimelineItemTypes + ",MERGED_EVENT,HEAD_REF_DELETED_EVENT,AUTO_MERGE_ENABLED_EVENT,AUTO_MERGE_DISABLED_EVENT"
47+ )
4548
4649// Inline-fragment selections, likewise split. These event types expose no databaseId,
4750// only the node id.
@@ -57,6 +60,7 @@ const issueTimelineFragments = `
5760 ... on DemilestonedEvent{id createdAt milestoneTitle actor{login ... on User{databaseId}}}
5861 ... on PinnedEvent{id createdAt actor{login ... on User{databaseId}}}
5962 ... on UnpinnedEvent{id createdAt actor{login ... on User{databaseId}}}`
63+
6064const prTimelineFragments = issueTimelineFragments + `
6165 ... on MergedEvent{id createdAt actor{login ... on User{databaseId}}}
6266 ... on HeadRefDeletedEvent{id createdAt headRefName actor{login ... on User{databaseId}}}
@@ -241,7 +245,7 @@ func (g *GithubDownloaderV3) attachTimelineEvents(ctx context.Context, nodeIDToI
241245// than aborting; a hot entity with more than one page sweeps the remainder.
242246func (g * GithubDownloaderV3 ) fetchTimelineEvents (ctx context.Context , ids []string ) (map [string ][]* base.Comment , error ) {
243247 if len (ids ) == 0 {
244- return nil , nil
248+ return map [ string ][] * base. Comment {} , nil
245249 }
246250 var resp struct {
247251 Nodes []struct {
@@ -262,9 +266,8 @@ func (g *GithubDownloaderV3) fetchTimelineEvents(ctx context.Context, ids []stri
262266 if err != nil {
263267 return nil , err
264268 }
265- for id , events := range right {
266- left [id ] = events
267- }
269+ maps .Copy (left , right )
270+
268271 return left , nil
269272 }
270273 return nil , err
0 commit comments