Skip to content

Commit

Permalink
Fix issue that visible runner groups are printed as if empty in log
Browse files Browse the repository at this point in the history
  • Loading branch information
mumoshu committed Feb 19, 2022
1 parent fcf4778 commit a9aea0b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions simulator/runnergroups.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package simulator
import (
"fmt"
"sort"
"strings"

"github.com/google/go-github/v39/github"
)
Expand Down Expand Up @@ -96,6 +97,10 @@ type RunnerGroup struct {
Name string
}

func (r RunnerGroup) String() string {
return fmt.Sprintf("RunnerGroup{Scope:%s, Kind:%s, Name:%s}", r.Scope, r.Kind, r.Name)
}

// VisibleRunnerGroups is a set of enterprise and organization runner groups
// that are visible to a GitHub repository.
// GitHub Actions chooses one of such visible group on which the workflow job is scheduled.
Expand All @@ -111,6 +116,15 @@ func NewVisibleRunnerGroups() *VisibleRunnerGroups {
return &VisibleRunnerGroups{}
}

func (g *VisibleRunnerGroups) String() string {
var gs []string
for _, g := range g.sortedGroups {
gs = append(gs, g.String())
}

return strings.Join(gs, ", ")
}

func (g *VisibleRunnerGroups) IsEmpty() bool {
return len(g.sortedGroups) == 0
}
Expand Down

0 comments on commit a9aea0b

Please sign in to comment.