@@ -102,24 +102,23 @@ func (gm *Manager) ChangeBranchHead(owner, repo, branch, sha string, force bool)
102
102
return nil
103
103
}
104
104
105
- func checkRunSet (cc int , cn string , edge Edge ) int {
105
+ func checkRunSet (checksPassed * int , cn string , edge Edge ) {
106
106
for _ , checkSuite := range edge .Node .CheckSuites .Nodes {
107
107
if (checkSuite .WorkflowRun != WorkflowRun {}) && githubv4 .String (cn ) == checkSuite .WorkflowRun .Workflow .Name {
108
108
if checkSuite .WorkflowRun .CheckSuite .Conclusion == githubv4 .String (githubv4 .StatusStateSuccess ) {
109
- cc ++
109
+ * checksPassed ++
110
110
continue
111
111
}
112
112
}
113
113
114
114
for _ , checkRuns := range checkSuite .CheckRuns .Nodes {
115
115
if githubv4 .String (cn ) == checkRuns .Name {
116
116
if checkRuns .Conclusion == githubv4 .String (githubv4 .StatusStateSuccess ) {
117
- cc ++
117
+ * checksPassed ++
118
118
}
119
119
}
120
120
}
121
121
}
122
- return cc
123
122
}
124
123
125
124
func hydrateCommits (q * Query , specificChecksNames string , sep string ) []Commit {
@@ -137,23 +136,22 @@ func hydrateCommits(q *Query, specificChecksNames string, sep string) []Commit {
137
136
statusSuccess := false
138
137
checkNames := strings .Split (specificChecksNames , sep )
139
138
numChecks := len (checkNames )
140
- sc := 0
141
- cc := 0
139
+ checksPassed := 0
142
140
143
141
for _ , cn := range checkNames {
144
-
145
142
// 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 ++
150
147
}
151
148
}
152
149
}
153
- cc = checkRunSet (cc , cn , edge )
150
+
151
+ checkRunSet (& checksPassed , cn , edge )
154
152
}
155
153
156
- if numChecks == sc || numChecks == cc {
154
+ if checksPassed == numChecks {
157
155
statusSuccess = true
158
156
}
159
157
0 commit comments