@@ -56,8 +56,9 @@ type GitHub struct {
5656}
5757
5858type Insight struct {
59- Title string `yaml:"title"`
60- DataSeries []map [string ]any `yaml:"dataSeries"`
59+ Title string `yaml:"title"`
60+ DataSeries []map [string ]any `yaml:"dataSeries"`
61+ DeleteWhenDone bool `yaml:"deleteWhenDone"`
6162}
6263
6364type ValidationSpec struct {
@@ -114,6 +115,7 @@ func DefaultConfig() *ValidationSpec {
114115 "timeScopeValue" : 1 ,
115116 },
116117 },
118+ DeleteWhenDone : true ,
117119 },
118120 }
119121}
@@ -171,7 +173,7 @@ func Validate(ctx context.Context, client api.Client, config *ValidationSpec) er
171173
172174 cloned , err := repoCloneTimeout (ctx , client , config .ExternalService )
173175 if err != nil {
174- return err //TODO make sure errors are wrapped once
176+ return err
175177 }
176178 if ! cloned {
177179 return errors .Newf ("%s validate failed, repo did not clone\n " , validate .FailureEmoji )
@@ -207,7 +209,7 @@ func Validate(ctx context.Context, client api.Client, config *ValidationSpec) er
207209 log .Printf ("%s insight successfully added" , validate .SuccessEmoji )
208210
209211 defer func () {
210- if insightId != "" {
212+ if insightId != "" && config . Insight . DeleteWhenDone {
211213 _ = removeInsight (ctx , client , insightId )
212214 log .Printf ("%s insight %s has been removed" , validate .SuccessEmoji , config .Insight .Title )
213215
0 commit comments