@@ -43,7 +43,7 @@ import Data.List.NonEmpty (NonEmpty, nonEmpty)
4343import qualified Data.List.NonEmpty as NonEmpty
4444import Data.Map.Strict (Map)
4545import qualified Data.Map.Strict as Map
46−import Data.Maybe (fromMaybe, mapMaybe)
46+import Data.Maybe (fromMaybe, mapMaybe, isNothing)
4747import Data.Monoid (Sum (Sum, getSum))
4848import Data.Sequence (Seq)
4949import qualified Data.Sequence as Seq
@@ -405,7 +405,8 @@ printBuildSummary
405405 summary
406406 topBrokenRdeps =
407407 Text.unlines $
408− headline <> totals
408+ headline <> [""] <> tldr <> ((" * "<>) <$> (errors <> warnings)) <> [""]
409+ <> totals
409410 <> optionalList "#### Maintained packages with build failure" (maintainedList fails)
410411 <> optionalList "#### Maintained packages with failed dependency" (maintainedList failedDeps)
411412 <> optionalList "#### Maintained packages with unknown error" (maintainedList unknownErr)
@@ -421,7 +422,7 @@ printBuildSummary
421422 [ "#### Build summary"
422423 , ""
423424 ]
424− <> printTable "Platform" (\x -> makeSearchLink id (platform x <> " " <> platformIcon x) ("." <> platform x)) (\x -> showT x <> " " <> icon x) showT (statusToNumSummary summary)
425+ <> printTable "Platform" (\x -> makeSearchLink id (platform x <> " " <> platformIcon x) ("." <> platform x)) (\x -> showT x <> " " <> icon x) showT numSummary
425426 headline =
426427 [ "### [haskell-updates build report from hydra](https://hydra.nixos.org/jobset/nixpkgs/haskell-updates)"
427428 , "*evaluation ["
@@ -437,7 +438,9 @@ printBuildSummary
437438 <> "*"
438439 ]
439440 brokenLine (name, rdeps) = "[" <> name <> "](https://search.nixos.org/packages?channel=unstable&show=haskellPackages." <> name <> "&query=haskellPackages." <> name <> ") :arrow_heading_up: " <> Text.pack (show rdeps)
440− jobsByState predicate = Map.filter (predicate . foldl' min Success . fmap state . summaryBuilds) summary
441+ numSummary = statusToNumSummary summary
442+ jobsByState predicate = Map.filter (predicate . worstState) summary
443+ worstState = foldl' min Success . fmap state . summaryBuilds
441444 fails = jobsByState (== Failed)
442445 failedDeps = jobsByState (== DependencyFailed)
443446 unknownErr = jobsByState (\x -> x > DependencyFailed && x < TimedOut)
@@ -449,6 +452,24 @@ printBuildSummary
449452 unmaintainedList = showBuild <=< sortOn (\(snd -> x) -> (negate (summaryUnbrokenReverseDeps x), negate (summaryReverseDeps x))) . Map.toList . withoutMaintainer
450453 showBuild (name, entry) = printJob id name (summaryBuilds entry, Text.pack (if summaryReverseDeps entry > 0 then " :arrow_heading_up: " <> show (summaryUnbrokenReverseDeps entry) <>" | "<> show (summaryReverseDeps entry) else ""))
451454 showMaintainedBuild (name, (table, maintainers)) = printJob id name (table, Text.intercalate " " (fmap ("@" <>) (toList maintainers)))
455+ tldr = case (errors, warnings) of
456+ ([],[]) -> [":green_circle: **Ready to merge**"]
457+ ([],_) -> [":yellow_circle: **Potential issues**"]
458+ _ -> [":red_circle: **Branch not mergeable**"]
459+ warnings =
460+ if' (Unfinished > maybe Success worstState maintainedJob) "`maintained` jobset failed." <>
461+ if' (Unfinished == maybe Success worstState mergeableJob) "`mergeable` jobset is not finished." <>
462+ if' (Unfinished == maybe Success worstState maintainedJob) "`maintained` jobset is not finished."
463+ errors =
464+ if' (isNothing mergeableJob) "No `mergeable` job found." <>
465+ if' (isNothing maintainedJob) "No `maintained` job found." <>
466+ if' (Unfinished > maybe Success worstState mergeableJob) "`mergeable` jobset failed." <>
467+ if' (outstandingJobs (Platform "x86_64-linux") > 100) "Too much outstanding jobs on x86_64-linux." <>
468+ if' (outstandingJobs (Platform "aarch64-linux") > 100) "Too much outstanding jobs on aarch64-linux."
469+ if' p e = if p then [e] else mempty
470+ outstandingJobs platform | Table m <- numSummary = Map.findWithDefault 0 (platform, Unfinished) m
471+ maintainedJob = Map.lookup "maintained" summary
472+ mergeableJob = Map.lookup "mergeable" summary
452473
453474printMaintainerPing :: IO ()
454475printMaintainerPing = do