Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion gh_org_mgr/_gh_org.py
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,25 @@ def _create_perms_changelist_for_teams(
continue

# Convert team name to Team object
team = self.org.get_team_by_slug(self._sluggify_teamname(team_name))
try:
team = self.org.get_team_by_slug(self._sluggify_teamname(team_name))
# Team not found, probably because a new team should be created, but it's a dry-run
except UnknownObjectException:
logging.debug(
"Team %s not found, probably because it should be created but it's a dry-run",
team_name,
)
# Initialise a new Team() object with the name, manually
team = Team(
requester=None, # type: ignore
headers={}, # No headers required
attributes={
"id": 0,
"name": team_name,
"slug": self._sluggify_teamname(team_name),
},
completed=True, # Mark as fully initialized
)

# Get configured repo permissions
for repo, perm in team_attrs.get("repos", {}).items():
Expand Down
Loading