[sysadmin-bin] Check if the repo has more than 1 commit before user removal



commit 8fb87e594a099a2138abf82dcfa647fb043372e0
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Tue Nov 30 13:45:40 2021 +0100

    Check if the repo has more than 1 commit before user removal

 gitlab/inactive-gitlab-users.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/gitlab/inactive-gitlab-users.py b/gitlab/inactive-gitlab-users.py
index e488786..12872e3 100755
--- a/gitlab/inactive-gitlab-users.py
+++ b/gitlab/inactive-gitlab-users.py
@@ -138,11 +138,13 @@ def get_inactive_users(gl, timedelta_unit, timedelta_value):
 
         user_projects = user.projects.list(all=True)
         if len(user_projects) == 1:
-            proj = user_projects[0]
-            if not proj.attributes.get("forked_from_project"):
-                userdata["reason"] = "inactivity"
-                results.append(userdata)
-                continue
+            userproj = user_projects[0]
+            if not userproj.attributes.get("forked_from_project"):
+                proj = gl.projects.get(userproj.id)
+                if len(proj.commits.list()) <= 1:
+                    userdata["reason"] = "inactivity"
+                    results.append(userdata)
+                    continue
 
         if attrs["bio"] and len(attrs["bio"]) > 0:
             # Some users set URL in bio, check it against surbl


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]