From 6a4067a7d6945de240d53bf052f531b359830a76 Mon Sep 17 00:00:00 2001 From: Typed SIGTERM Date: Wed, 5 Aug 2026 19:12:31 +0800 Subject: [PATCH 1/2] fix!: exclude inherited members from --- gh_org_mgr/_gh_org.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/gh_org_mgr/_gh_org.py b/gh_org_mgr/_gh_org.py index cc9a25c..d11de9f 100644 --- a/gh_org_mgr/_gh_org.py +++ b/gh_org_mgr/_gh_org.py @@ -512,14 +512,22 @@ def _get_configured_team_members( return [] def _get_current_team_members(self, team: Team) -> dict[NamedUser, str]: - """Return dict of current users with their respective roles. Also - contains members of child teams. + """Return dict of current users with their respective roles. Only + contains direct members of the team, not members of child teams. """ current_users: dict[NamedUser, str] = {} for role in ("member", "maintainer"): - # Make a two-step check whether person is actually in team, as - # get_members() also return child-team members + # Check whether person is actually direct member of team, as + # get_members() also returns child-team members, marked via the + # "inherited" flag in the API response for user in list(team.get_members(role=role)): + if user.raw_data.get("inherited"): + logging.debug( + "User '%s' is only member of a child team of '%s', ignoring", + user.login, + team.name, + ) + continue current_users.update({user: role}) return current_users From 3482996e334d11139f9a3cbe06b6cad69cef7259 Mon Sep 17 00:00:00 2001 From: Typed SIGTERM Date: Wed, 5 Aug 2026 20:09:05 +0800 Subject: [PATCH 2/2] fix: property --- gh_org_mgr/_gh_org.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gh_org_mgr/_gh_org.py b/gh_org_mgr/_gh_org.py index d11de9f..b2d3c03 100644 --- a/gh_org_mgr/_gh_org.py +++ b/gh_org_mgr/_gh_org.py @@ -521,7 +521,7 @@ def _get_current_team_members(self, team: Team) -> dict[NamedUser, str]: # get_members() also returns child-team members, marked via the # "inherited" flag in the API response for user in list(team.get_members(role=role)): - if user.raw_data.get("inherited"): + if user._rawData.get("inherited"): logging.debug( "User '%s' is only member of a child team of '%s', ignoring", user.login,