evalCloseSticky checks whether a closed issue or PR stayed closed.
(item CreatedItemReport, repoOverride string)
| 11 | |
| 12 | // evalCloseSticky checks whether a closed issue or PR stayed closed. |
| 13 | func 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. |
nothing calls this directly
no test coverage detected