Skip to content

Commit

Permalink
AI summary does not fail the build (#103)
Browse files Browse the repository at this point in the history
* AI summary does not fail the build

* clean up github statuses
  • Loading branch information
djeebus authored Jan 10, 2024
1 parent 197a3c0 commit 6d7a424
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/diff/ai_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func AIDiffSummary(ctx context.Context, mrNote *pkg.Message, name string, manife
if err != nil {
telemetry.SetError(span, err, "OpenAI SummarizeDiff")
log.Error().Err(err).Msg("failed to summarize diff")
cr := pkg.CheckResult{State: pkg.StateWarning, Summary: "failed to summarize diff", Details: err.Error()}
cr := pkg.CheckResult{State: pkg.StateNone, Summary: "failed to summarize diff", Details: err.Error()}
mrNote.AddToAppMessage(ctx, name, cr)
return
}
Expand Down
11 changes: 5 additions & 6 deletions pkg/vcs/github_client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,17 +156,16 @@ func toGithubCommitStatus(state pkg.CommitState) *string {
switch state {
case pkg.StateError, pkg.StatePanic:
return pkg.Pointer("error")
case pkg.StateFailure, pkg.StateWarning:
case pkg.StateFailure:
return pkg.Pointer("failure")
case pkg.StateRunning:
return pkg.Pointer("pending")
case pkg.StateSuccess:
case pkg.StateSuccess, pkg.StateWarning, pkg.StateNone:
return pkg.Pointer("success")

default: // maybe a different one? panic?
log.Warn().Str("state", state.String()).Msg("failed to convert to a github commit status")
return pkg.Pointer("failure")
}

log.Warn().Str("state", state.String()).Msg("failed to convert to a github commit status")
return pkg.Pointer("failure")
}

func (c *Client) CommitStatus(ctx context.Context, repo *repo.Repo, status pkg.CommitState) error {
Expand Down

0 comments on commit 6d7a424

Please sign in to comment.