From 15aa5257facaa259a9caafaf7f7db9ab08cfd7f6 Mon Sep 17 00:00:00 2001 From: Dennis Haney Date: Thu, 28 Sep 2023 17:57:49 +0700 Subject: [PATCH] fix timestamp not right type --- pkg/services/github.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pkg/services/github.go b/pkg/services/github.go index 083037fa..bacce4c9 100644 --- a/pkg/services/github.go +++ b/pkg/services/github.go @@ -48,7 +48,7 @@ type GitHubStatus struct { TargetURL string `json:"targetURL,omitempty"` } -//copy of github:UpdateCheckRunOptions + id +//copy of github:UpdateCheckRunOptions + id + timestamp as string type GitHubCheckRun struct { Id string `json:"id"` // check_id, actually an int64, but string since we want it to be template'able. (Optional - create new check-run for revision if missing.) Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.) @@ -370,8 +370,8 @@ func (g gitHubService) Send(notification Notification, _ Destination) error { u[0], u[1], &github.CreateCheckRunOptions{ - HeadSHA: ¬ification.GitHub.revision, - Name: ¬ification.GitHub.Deployment.Environment, + Name: notification.GitHub.CheckRun.Name, + HeadSHA: notification.GitHub.revision, }, ) if err != nil { @@ -379,18 +379,26 @@ func (g gitHubService) Send(notification Notification, _ Destination) error { } id := checkrun.ID } + var timestamp *github.Timestamp + if notifications.GitHub.CheckRun.CompletedAt != nil { + parsedTime, err = time.Parse("2006-01-02T15:04:05Z07:00", notifications.GitHub.CheckRun.CompletedAt) + if err != nil { + return err + } + timestamp = &Timestamp{parsedTime} + } _, _, err = g.client.Checks.UpdateCheckRun( context.Background(), u[0], u[1], id, &github.UpdateCheckRunOptions{ - Name : ¬ifications.GitHub.CheckRun.Name, + Name : notifications.GitHub.CheckRun.Name, DetailsURL : ¬ifications.GitHub.CheckRun.DetailsURL, ExternalID : ¬ifications.GitHub.CheckRun.ExternalID, Status : ¬ifications.GitHub.CheckRun.Status, Conclusion : ¬ifications.GitHub.CheckRun.Conclusion, - CompletedAt: ¬ifications.GitHub.CheckRun.CompletedAt, + CompletedAt: timestamp, Output : ¬ifications.GitHub.CheckRun.Output, Actions : ¬ifications.GitHub.CheckRun.Actions, },