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.
This commit is contained in:
@@ -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 = [ ];
|
||||
|
||||
@@ -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 =
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user