workflows/eval: add markdown of added, removed and changed (#360339)

This commit is contained in:
Jörg Thalheim
2024-12-01 16:53:49 +01:00
committed by GitHub
3 changed files with 17 additions and 1 deletions

View File

@@ -210,7 +210,7 @@ jobs:
--arg beforeResultDir ./baseResult \
--arg afterResultDir ./prResult \
-o comparison
cat comparison/step-summary.md >> "$GITHUB_STEP_SUMMARY"
# TODO: Request reviews from maintainers for packages whose files are modified in the PR
- name: Upload the combined results

View File

@@ -261,6 +261,7 @@ let
--slurpfile after ${afterResultDir}/outpaths.json \
> $out/changed-paths.json
jq -r -f ${./generate-step-summary.jq} < $out/changed-paths.json > $out/step-summary.md
# TODO: Compare eval stats
'';

View File

@@ -0,0 +1,15 @@
def truncate(xs; n):
if xs | length > n then xs[:n] + ["..."]
else xs
end;
def itemize_packages(xs):
# we truncate the list to stay below the GitHub limit of 1MB per step summary.
truncate(xs; 3000) | map("- [\(.)](https://search.nixos.org/packages?channel=unstable&show=\(.)&from=0&size=50&sort=relevance&type=packages&query=\(.))") | join("\n");
def section(title; xs):
"<details> <summary>" + title + " (" + (xs | length | tostring) + ")</summary>\n\n" + itemize_packages(xs) + "</details>";
section("Added packages"; .attrdiff.added) + "\n\n" +
section("Removed packages"; .attrdiff.removed) + "\n\n" +
section("Changed packages"; .attrdiff.changed)