@@ -102,24 +102,23 @@ func (gm *Manager) ChangeBranchHead(owner, repo, branch, sha string, force bool)
102102 return nil
103103}
104104
105- func checkRunSet (cc int , cn string , edge Edge ) int {
105+ func checkRunSet (checksPassed * int , cn string , edge Edge ) {
106106 for _ , checkSuite := range edge .Node .CheckSuites .Nodes {
107107 if (checkSuite .WorkflowRun != WorkflowRun {}) && githubv4 .String (cn ) == checkSuite .WorkflowRun .Workflow .Name {
108108 if checkSuite .WorkflowRun .CheckSuite .Conclusion == githubv4 .String (githubv4 .StatusStateSuccess ) {
109- cc ++
109+ * checksPassed ++
110110 continue
111111 }
112112 }
113113
114114 for _ , checkRuns := range checkSuite .CheckRuns .Nodes {
115115 if githubv4 .String (cn ) == checkRuns .Name {
116116 if checkRuns .Conclusion == githubv4 .String (githubv4 .StatusStateSuccess ) {
117- cc ++
117+ * checksPassed ++
118118 }
119119 }
120120 }
121121 }
122- return cc
123122}
124123
125124func hydrateCommits (q * Query , specificChecksNames string , sep string ) []Commit {
@@ -137,23 +136,22 @@ func hydrateCommits(q *Query, specificChecksNames string, sep string) []Commit {
137136 statusSuccess := false
138137 checkNames := strings .Split (specificChecksNames , sep )
139138 numChecks := len (checkNames )
140- sc := 0
141- cc := 0
139+ checksPassed := 0
142140
143141 for _ , cn := range checkNames {
144-
145142 // first check if commit has commit status set
146- for _ , context := range edge .Node .Status .Contexts {
147- if githubv4 .String (cn ) == context .Context {
148- if context .State == githubv4 .String (githubv4 .StatusStateSuccess ) {
149- sc ++
143+ for _ , ctx := range edge .Node .Status .Contexts {
144+ if githubv4 .String (cn ) == ctx .Context {
145+ if ctx .State == githubv4 .String (githubv4 .StatusStateSuccess ) {
146+ checksPassed ++
150147 }
151148 }
152149 }
153- cc = checkRunSet (cc , cn , edge )
150+
151+ checkRunSet (& checksPassed , cn , edge )
154152 }
155153
156- if numChecks == sc || numChecks == cc {
154+ if checksPassed == numChecks {
157155 statusSuccess = true
158156 }
159157
0 commit comments