[sysadmin-bin] Set default branch as protected



commit ceaafc72fd9bbc788975dcfd010c587fa0421768
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Wed Oct 23 19:56:25 2019 +0200

    Set default branch as protected

 gitlab/gitlab-operations.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/gitlab/gitlab-operations.py b/gitlab/gitlab-operations.py
index 70f19fc..f0f286a 100755
--- a/gitlab/gitlab-operations.py
+++ b/gitlab/gitlab-operations.py
@@ -106,6 +106,10 @@ for project in projects:
         stable_branches = set(filter(stable_branches_regex.match, branches))
         protected_branches = {branch.name for branch in proj.protectedbranches.list()}
 
+        if default_branch not in protected_branches:
+            branch = proj.branches.get(default_branch, lazy=True)
+            branch.protect(developers_can_push=True, developers_can_merge=True)
+
         for branch_name in (stable_branches - protected_branches):
             branch = proj.branches.get(branch_name, lazy=True)
             branch.protect(developers_can_push=True, developers_can_merge=True)


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