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

Function evalCloseSticky

pkg/cli/outcome_eval_generic.go:13–45  ·  view source on GitHub ↗

evalCloseSticky checks whether a closed issue or PR stayed closed.

(item CreatedItemReport, repoOverride string)

Source from the content-addressed store, hash-verified

11
12// evalCloseSticky checks whether a closed issue or PR stayed closed.
13func evalCloseSticky(item CreatedItemReport, repoOverride string) OutcomeReport {
14 repo := resolveItemRepo(item, repoOverride)
15 num := resolveItemNumber(item)
16 outcomeEvalGenericLog.Printf("Evaluating close_sticky: type=%s, repo=%s, num=%d", item.Type, repo, num)
17 report := OutcomeReport{
18 Type: item.Type,
19 ObjectURL: item.URL,
20 ObjectNumber: num,
21 Repo: repo,
22 }
23 if num == 0 || repo == "" {
24 report.Result = OutcomeError
25 report.EvalError = "missing number or repo"
26 return report
27 }
28
29 data, err := ghAPIGet(fmt.Sprintf("issues/%d", num), repo)
30 if err != nil {
31 report.Result = OutcomeError
32 report.EvalError = err.Error()
33 return report
34 }
35
36 state, _ := data["state"].(string)
37 if state == "closed" {
38 report.Result = OutcomeAccepted
39 report.Detail = "still closed"
40 } else {
41 report.Result = OutcomeRejected
42 report.Detail = "reopened"
43 }
44 return report
45}
46
47// evalCloseDiscussion checks whether a closed discussion stayed closed.
48// Uses REST API approximation since discussions don't have a direct REST endpoint.

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected