Skip to content

Commit 15aa525

Browse files
authored
fix timestamp not right type
1 parent 91ef26c commit 15aa525

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

pkg/services/github.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ type GitHubStatus struct {
4848
TargetURL string `json:"targetURL,omitempty"`
4949
}
5050

51-
//copy of github:UpdateCheckRunOptions + id
51+
//copy of github:UpdateCheckRunOptions + id + timestamp as string
5252
type GitHubCheckRun struct {
5353
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.)
5454
Name string `json:"name"` // The name of the check (e.g., "code-coverage"). (Required.)
@@ -370,27 +370,35 @@ func (g gitHubService) Send(notification Notification, _ Destination) error {
370370
u[0],
371371
u[1],
372372
&github.CreateCheckRunOptions{
373-
HeadSHA: &notification.GitHub.revision,
374-
Name: &notification.GitHub.Deployment.Environment,
373+
Name: notification.GitHub.CheckRun.Name,
374+
HeadSHA: notification.GitHub.revision,
375375
},
376376
)
377377
if err != nil {
378378
return err
379379
}
380380
id := checkrun.ID
381381
}
382+
var timestamp *github.Timestamp
383+
if notifications.GitHub.CheckRun.CompletedAt != nil {
384+
parsedTime, err = time.Parse("2006-01-02T15:04:05Z07:00", notifications.GitHub.CheckRun.CompletedAt)
385+
if err != nil {
386+
return err
387+
}
388+
timestamp = &Timestamp{parsedTime}
389+
}
382390
_, _, err = g.client.Checks.UpdateCheckRun(
383391
context.Background(),
384392
u[0],
385393
u[1],
386394
id,
387395
&github.UpdateCheckRunOptions{
388-
Name : &notifications.GitHub.CheckRun.Name,
396+
Name : notifications.GitHub.CheckRun.Name,
389397
DetailsURL : &notifications.GitHub.CheckRun.DetailsURL,
390398
ExternalID : &notifications.GitHub.CheckRun.ExternalID,
391399
Status : &notifications.GitHub.CheckRun.Status,
392400
Conclusion : &notifications.GitHub.CheckRun.Conclusion,
393-
CompletedAt: &notifications.GitHub.CheckRun.CompletedAt,
401+
CompletedAt: timestamp,
394402
Output : &notifications.GitHub.CheckRun.Output,
395403
Actions : &notifications.GitHub.CheckRun.Actions,
396404
},

0 commit comments

Comments
 (0)