From 149cf47c831c74f2764b2ddef92f2d85c39938f5 Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Mon, 27 Feb 2023 07:34:29 +0900 Subject: [PATCH] Fix actions-metrics-server segfault issue (#2325) --- pkg/actionsmetrics/event_reader.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/actionsmetrics/event_reader.go b/pkg/actionsmetrics/event_reader.go index 28b09e40..4beb33f5 100644 --- a/pkg/actionsmetrics/event_reader.go +++ b/pkg/actionsmetrics/event_reader.go @@ -131,6 +131,10 @@ func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event in if *e.WorkflowJob.Conclusion == "failure" { failedStep := "null" for i, step := range e.WorkflowJob.Steps { + conclusion := step.Conclusion + if conclusion == nil { + continue + } // *step.Conclusion ~ // "success", @@ -141,11 +145,11 @@ func (reader *EventReader) ProcessWorkflowJobEvent(ctx context.Context, event in // "timed_out", // "action_required", // null - if *step.Conclusion == "failure" { + if *conclusion == "failure" { failedStep = fmt.Sprint(i) break } - if *step.Conclusion == "timed_out" { + if *conclusion == "timed_out" { failedStep = fmt.Sprint(i) parseResult.ExitCode = "timed_out" break