From cd1466e2cd38d01aa182a31c2aa6cccc2ae6bf14 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Thu, 16 Oct 2025 13:29:00 +0200 Subject: [PATCH] ci/eval/compare/maintainers: ping by-name reviewers for all rebuilds This adds support to ping maintainers when arbitrary files in by-name are changed, as long as they still cause a rebuild. For example, this is the case when changing .json files with version metadata. These were previously not detected as belonging to the package, and didn't cause maintainer pings. (cherry picked from commit 0a5ffcdf3182ed7b6556fb3ec756634a037cbdc4) --- ci/eval/compare/maintainers.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ci/eval/compare/maintainers.nix b/ci/eval/compare/maintainers.nix index 8aacf2f6d644..1ddad23da909 100644 --- a/ci/eval/compare/maintainers.nix +++ b/ci/eval/compare/maintainers.nix @@ -11,21 +11,29 @@ let changedpaths = lib.importJSON changedpathsjson; - anyMatchingFile = filename: lib.any (changed: changed == filename) changedpaths; + anyMatchingFile = filename: lib.any (lib.hasPrefix filename) changedpaths; anyMatchingFiles = files: lib.any anyMatchingFile files; + sharded = name: "${lib.substring 0 2 name}/${name}"; + attrsWithMaintainers = lib.pipe (changedattrs ++ removedattrs) [ (map ( name: let + path = lib.splitString "." name; # Some packages might be reported as changed on a different platform, but # not even have an attribute on the platform the maintainers are requested on. # Fallback to `null` for these to filter them out below. - package = lib.attrByPath (lib.splitString "." name) null pkgs; + package = lib.attrByPath path null pkgs; in { inherit name package; + # Adds all files in by-name to each package, no matter whether they are discoverable + # via meta attributes below. For example, this allows pinging maintainers for + # updates to .json files. + # TODO: Support by-name package sets. + filenames = lib.optional (lib.length path == 1) "pkgs/by-name/${sharded (lib.head path)}/"; # TODO: Refactor this so we can ping entire teams instead of the individual members. # Note that this will require keeping track of GH team IDs in "maintainers/teams.nix". maintainers = package.meta.maintainers or [ ]; @@ -63,7 +71,7 @@ let )); attrsWithFilenames = map ( - pkg: pkg // { filenames = relevantFilenames pkg.package; } + pkg: pkg // { filenames = pkg.filenames ++ relevantFilenames pkg.package; } ) attrsWithMaintainers; attrsWithModifiedFiles = lib.filter (pkg: anyMatchingFiles pkg.filenames) attrsWithFilenames;