MCPcopy Create free account
hub / github.com/github/gh-aw / evalMarkReady

Function evalMarkReady

pkg/cli/outcome_eval_generic.go:139–182  ·  view source on GitHub ↗

evalMarkReady checks whether a PR marked as ready received reviews.

(item CreatedItemReport, repoOverride string)

Source from the content-addressed store, hash-verified

137
138// evalMarkReady checks whether a PR marked as ready received reviews.
139func evalMarkReady(item CreatedItemReport, repoOverride string) OutcomeReport {
140 repo := resolveItemRepo(item, repoOverride)
141 num := resolveItemNumber(item)
142 outcomeEvalGenericLog.Printf("Evaluating mark_ready: repo=%s, num=%d", repo, num)
143 report := OutcomeReport{
144 Type: item.Type,
145 ObjectURL: item.URL,
146 ObjectNumber: num,
147 Repo: repo,
148 }
149 if num == 0 || repo == "" {
150 report.Result = OutcomeError
151 report.EvalError = "missing number or repo"
152 return report
153 }
154
155 reviews, err := ghAPIGetArray(fmt.Sprintf("pulls/%d/reviews", num), repo)
156 if err != nil {
157 report.Result = OutcomeError
158 report.EvalError = err.Error()
159 return report
160 }
161
162 if len(reviews) > 0 {
163 report.Result = OutcomeAccepted
164 report.Detail = fmt.Sprintf("%d reviews submitted", len(reviews))
165 } else {
166 data, derr := ghAPIGet(fmt.Sprintf("pulls/%d", num), repo)
167 if derr == nil {
168 state, _ := data["state"].(string)
169 if state == "open" {
170 report.Result = OutcomePending
171 report.Detail = "awaiting review"
172 } else {
173 report.Result = OutcomeIgnored
174 report.Detail = "closed/merged without review"
175 }
176 } else {
177 report.Result = OutcomePending
178 report.Detail = "no reviews yet"
179 }
180 }
181 return report
182}
183
184// evalPushToPRBranch checks whether the PR the code was pushed to got merged.
185func evalPushToPRBranch(item CreatedItemReport, repoOverride string) OutcomeReport {

Callers

nothing calls this directly

Calls 6

resolveItemRepoFunction · 0.85
resolveItemNumberFunction · 0.85
ghAPIGetArrayFunction · 0.85
ghAPIGetFunction · 0.85
PrintfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected