[sysadmin-bin] Add script finding fake public repositories



commit da0a5618becc7afd838606826a0c0e3986e261d0
Author: Bartłomiej Piotrowski <bpiotrowski gnome org>
Date:   Fri Jan 31 12:38:10 2020 +0100

    Add script finding fake public repositories

 gitlab/fake-public-repos.py | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/gitlab/fake-public-repos.py b/gitlab/fake-public-repos.py
new file mode 100644
index 0000000..8f41404
--- /dev/null
+++ b/gitlab/fake-public-repos.py
@@ -0,0 +1,28 @@
+#!/usr/include/python
+
+import os
+import gitlab
+
+GITLAB_TOKEN = os.getenv("GITLAB_TOKEN")
+if GITLAB_TOKEN is None:
+    with open("/home/admin/secret/gitlab_rw") as f:
+        tokenfile = f.readline()
+    GITLAB_TOKEN = tokenfile.rstrip().split("=")[1]
+
+gl = gitlab.Gitlab(
+    "https://gitlab.gnome.org";, private_token=GITLAB_TOKEN, per_page=100
+)
+gl.auth()
+
+projects = gl.projects.list(all=True)
+for project in projects:
+    attrs = project.attributes
+    if attrs['visibility'] != 'public':
+        continue
+
+    issues_access_level = attrs['issues_access_level'] == 'private'
+    repository_access_level = attrs['repository_access_level'] == 'private'
+    merge_requests_access_level = attrs['merge_requests_access_level'] == 'private'
+
+    if all([issues_access_level, repository_access_level, merge_requests_access_level]):
+        print project.path_with_namespace


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