Verified Commit f8600c0a authored by Adrian DC's avatar Adrian DC
Browse files

fix(gitlab): unarchive group projects upon group removal

Issue: #5
---

Signed-off-by: default avatarAdrian DC <radian.dc@gmail.com>
parent ce951278
Loading
Loading
Loading
Loading
Loading
+20 −2
Changes for src/features/gitlab.py: 20 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ from ..types.gitlab import (
    RolesCreateSubgroups,
)

# GitLabFeature class, pylint: disable=too-many-public-methods
# GitLabFeature class, pylint: disable=too-many-lines,too-many-public-methods
class GitLabFeature:

    # Constants
@@ -92,8 +92,26 @@ class GitLabFeature:
        criteria: str,
    ) -> None:

        # Delete group
        # Acquire group
        group = self.group(criteria)

        # Unarchive projects
        if not self.__dry_run:
            projects = sorted(
                group.projects.list(
                    get_all=True,
                    with_shared=False,
                    include_subgroups=True,
                    order_by='path',
                    sort='asc',
                ),
                key=lambda item: item.path_with_namespace,
            )
            for project in projects:
                if project.archived:
                    self.project(project.id).unarchive()

        # Delete group
        if not self.__dry_run:
            group.delete()
            sleep(1)