From fc1be89a2febf10809c32a4219cbca313b6b4273 Mon Sep 17 00:00:00 2001 From: Ryan Albert Date: Fri, 10 May 2024 12:27:05 -0700 Subject: [PATCH] feat: correctly track publishing event errors --- internal/actions/publishEvent.go | 4 +--- internal/telemetry/telemetry.go | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/actions/publishEvent.go b/internal/actions/publishEvent.go index f10ddc8c..056e2931 100644 --- a/internal/actions/publishEvent.go +++ b/internal/actions/publishEvent.go @@ -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 }) diff --git a/internal/telemetry/telemetry.go b/internal/telemetry/telemetry.go index 11a55baf..07c3612c 100644 --- a/internal/telemetry/telemetry.go +++ b/internal/telemetry/telemetry.go @@ -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 = ¤tIntegrationEnvironment