Skip to content

Commit

Permalink
feat: correctly track publishing event errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-timothy-albert committed May 10, 2024
1 parent 497a116 commit fc1be89
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 1 addition & 3 deletions internal/actions/publishEvent.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ func PublishEvent() error {
return processingErr
}

if !strings.Contains(strings.ToLower(os.Getenv("GH_ACTION_RESULT")), "success") {
return fmt.Errorf("failure in publishing: %s", os.Getenv("GH_ACTION_RESULT"))
}
event.Success = strings.Contains(strings.ToLower(os.Getenv("GH_ACTION_RESULT")), "success")

return nil
})
Expand Down
6 changes: 5 additions & 1 deletion internal/telemetry/telemetry.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ func Track(ctx context.Context, exec shared.InteractionType, fn func(ctx context
runEvent.LocalCompletedAt = &curTime
duration := runEvent.LocalCompletedAt.Sub(runEvent.LocalStartedAt).Milliseconds()
runEvent.DurationMs = &duration
runEvent.Success = err == nil

// For publishing events runEvent success is set by publishEvent.go
if exec != shared.InteractionTypePublish {
runEvent.Success = err == nil
}
currentIntegrationEnvironment := "GITHUB_ACTIONS"
runEvent.ContinuousIntegrationEnvironment = &currentIntegrationEnvironment

Expand Down

0 comments on commit fc1be89

Please sign in to comment.