From 7636389851e31bf2f5d7712c009105e33a66a750 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 22 Oct 2025 17:07:07 +0200 Subject: [PATCH] lib.teams: Add githubId from associated github teams This will allow the code for https://github.com/NixOS/nixpkgs/issues/447514 to make sure that the right team is requested for review, even if it has been renamed in the meantime. While the matching is currently based on the teams slug/name and not the id, renames won't cause problems with `lib.teams`, because CI would error if there's no match. Changing this can be future work. --- lib/tests/teams.nix | 4 ++++ maintainers/computed-team-list.nix | 9 +++++++++ maintainers/team-list.nix | 1 + 3 files changed, 14 insertions(+) diff --git a/lib/tests/teams.nix b/lib/tests/teams.nix index 726e7f63a8e9..ed7db2b873f1 100644 --- a/lib/tests/teams.nix +++ b/lib/tests/teams.nix @@ -31,6 +31,10 @@ let type = types.str; default = ""; }; + githubId = lib.mkOption { + type = types.int; + default = 0; + }; githubMaintainers = lib.mkOption { type = types.listOf (types.submodule ./maintainer-module.nix); default = [ ]; diff --git a/maintainers/computed-team-list.nix b/maintainers/computed-team-list.nix index bcb8a0f9c237..7ee37f4283e3 100644 --- a/maintainers/computed-team-list.nix +++ b/maintainers/computed-team-list.nix @@ -20,6 +20,8 @@ let ); in +# TODO: Consider automatically exposing all GitHub teams under `lib.teams`, +# so that no manual PRs are necessary to add such teams anymore lib.mapAttrs ( name: attrs: if attrs ? github then @@ -28,6 +30,12 @@ lib.mapAttrs ( githubTeams.${attrs.github} or (throw "lib.teams.${name}: Corresponding GitHub team ${attrs.github} not known yet, make sure to create it and wait for the regular team sync"); in + # TODO: Consider specifying `githubId` in team-list.nix and inferring `github` from it (or even dropping it) + # This would make renames easier because no additional place needs to keep track of them. + # Though in a future where all Nixpkgs GitHub teams are automatically exposed under `lib.teams`, + # this would also not be an issue anymore. + assert lib.assertMsg (!attrs ? githubId) + "lib.teams.${name}: Both `githubId` and `github` is set, but the former is synced from the latter"; assert lib.assertMsg (!attrs ? shortName) "lib.teams.${name}: Both `shortName` and `github` is set, but the former is synced from the latter"; assert lib.assertMsg ( @@ -38,6 +46,7 @@ lib.mapAttrs ( ) "lib.teams.${name}: Both `members` and `github` is set, but the former is synced from the latter"; attrs // { + githubId = githubTeam.id; shortName = githubTeam.name; scope = githubTeam.description; members = diff --git a/maintainers/team-list.nix b/maintainers/team-list.nix index b9c155748e38..9774b61d7e25 100644 --- a/maintainers/team-list.nix +++ b/maintainers/team-list.nix @@ -17,6 +17,7 @@ - There is limited mention capacity in a single post, so this should be reserved for critical components or larger ecosystems within nixpkgs. - `github` will ping the specified GitHub team and sync the `members`, `scope` and `shortName` fields from it + - `githubId` will be set automatically based on `github` If `github` is specified and you'd like to be added to the team, contact one of the `githubMaintainers` of the team: