This commit is contained in:
Jeremy Donahue 2025-10-17 17:02:35 +02:00 committed by GitHub
commit b2c29b554c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 0 deletions

View File

@ -244,6 +244,22 @@ func (reader *EventReader) fetchAndParseWorkflowJobLogs(ctx context.Context, e *
startedTime time.Time
completedTime time.Time
)
// Default these values to the timestamps contained in the event. They will
// be updated if the log contains more accurate values, however the
// "Waiting for a runner to pick up this job..." and "Job is about to start
// running on the runner:" lines are only present in the logs until the job
// has finished, at which point they are removed from the job logs by
// Github, so they can't be used to calculate the job duration after the
// job has finished.
if e.WorkflowJob.CreatedAt != nil {
queuedTime = e.WorkflowJob.CreatedAt.Time
}
if e.WorkflowJob.StartedAt != nil {
startedTime = e.WorkflowJob.StartedAt.Time
}
if e.WorkflowJob.CompletedAt != nil {
completedTime = e.WorkflowJob.CompletedAt.Time
}
func() {
// Read jobLogs.Body line by line