From a9aea0bd9cd9f64ed4018082658c3300a0a2869c Mon Sep 17 00:00:00 2001 From: Yusuke Kuoka Date: Sat, 19 Feb 2022 05:33:32 +0000 Subject: [PATCH] Fix issue that visible runner groups are printed as if empty in log --- simulator/runnergroups.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/simulator/runnergroups.go b/simulator/runnergroups.go index ccc961c3d9..83e1172bdd 100644 --- a/simulator/runnergroups.go +++ b/simulator/runnergroups.go @@ -3,6 +3,7 @@ package simulator import ( "fmt" "sort" + "strings" "github.com/google/go-github/v39/github" ) @@ -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. @@ -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 }