Skip to content

Commit

Permalink
skip rendering hooks when none are detected
Browse files Browse the repository at this point in the history
  • Loading branch information
djeebus committed Apr 11, 2024
1 parent de77d92 commit ee89bce
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/checks/hooks/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ func Check(_ context.Context, request checks.Request) (msg.Result, error) {
phaseDetails = append(phaseDetails, phaseDetail)
}

if len(phaseNames) == 0 {
return msg.Result{State: pkg.StateSkip}, nil
}

return msg.Result{
State: pkg.StateNone,
Summary: fmt.Sprintf("<b>Sync Phases: %s</b>", strings.Join(toStringSlice(phaseNames), ", ")),
Expand Down
1 change: 1 addition & 0 deletions pkg/commitState.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type CommitState uint8
// must be in order of best to worst, in order for WorstState to work
const (
StateNone CommitState = iota
StateSkip
StateSuccess
StateRunning
StateWarning
Expand Down
4 changes: 4 additions & 0 deletions pkg/msg/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ func (m *Message) BuildComment(ctx context.Context, start time.Time, commitSHA,
continue
}

if check.State == pkg.StateSkip {
continue
}

var summary string
if check.State == pkg.StateNone {
summary = check.Summary
Expand Down

0 comments on commit ee89bce

Please sign in to comment.