From cf2f151129362b678e1bbcba0d240653269ebb0a Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 18 May 2024 22:23:39 -0600 Subject: imworkingon: Fix updated-by for GH PRs that haven't been updated --- cmd/generate/src_contribs.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'cmd') diff --git a/cmd/generate/src_contribs.go b/cmd/generate/src_contribs.go index 6db6764..f22f721 100644 --- a/cmd/generate/src_contribs.go +++ b/cmd/generate/src_contribs.go @@ -266,8 +266,15 @@ func (c Contribution) fetchLastUpdated() (time.Time, User, error) { var obj struct { UpdatedAt time.Time `json:"updated_at"` - MergedAt time.Time `json:"merged_at"` - MergedBy struct { + + CreatedAt time.Time `json:"created_at"` + CreatedBy struct { + Login string `json:"login"` + HTMLURL string `json:"html_url"` + } `json:"user"` + + MergedAt time.Time `json:"merged_at"` + MergedBy struct { Login string `json:"login"` HTMLURL string `json:"html_url"` } `json:"merged_by"` @@ -279,7 +286,11 @@ func (c Contribution) fetchLastUpdated() (time.Time, User, error) { retUpdatedAt := obj.UpdatedAt var retUser User - if obj.MergedAt == retUpdatedAt { + if retUser == (User{}) && obj.CreatedAt == retUpdatedAt { + retUser.Name = obj.CreatedBy.Login + retUser.URL = obj.CreatedBy.HTMLURL + } + if retUser == (User{}) && obj.MergedAt == retUpdatedAt { retUser.Name = obj.MergedBy.Login retUser.URL = obj.MergedBy.HTMLURL } -- cgit v1.2.3-54-g00ecf