[gnome-build-meta/abderrahim/update-refs-script] test




commit 168f720265c019a56ed42c6d559ce3daad8eef3b
Author: Jordan Petridis <jordan centricular com>
Date:   Tue Oct 4 16:44:26 2022 +0200

    test

 .gitlab-ci.yml                           | 11 +++++++++++
 utils/check-open-mrs.py                  | 18 ++++++++++++++++++
 utils/{update_refs.py => update-refs.py} |  0
 3 files changed, 29 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a990202c4..0ad92561c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -531,6 +531,17 @@ test-pinephone-pro-aarch64:
   - aarch64
   - gnome-build-meta
 
+update_refs:
+  stage: 'track'
+  script:
+    - git config --global user.email "sysadmin gnome org"
+    - git config --global user.name "gnomebot"
+
+    - python3 utils/check-open-mrs.py
+    - python3 utils/update-refs.py
+
+    - git push -o merge_request.create -o merge_request.assign=44433 -o merge_request.remove_source_branch
+
 
 pages:
   stage: 'reports'
diff --git a/utils/check-open-mrs.py b/utils/check-open-mrs.py
new file mode 100644
index 000000000..ca19a279f
--- /dev/null
+++ b/utils/check-open-mrs.py
@@ -0,0 +1,18 @@
+#! /usr/bin/env python3
+
+import requests
+import os
+
+def check_for_existing_mr():
+  headers = {'JOB_TOKEN': os.environ["CI_JOB_TOKEN"] }
+
+  # FIXME:
+  url = f"https://gitlab.gnome.org/api/v4/projects/456/merge_requests?author_username=bertob&state=opened";
+
+  resp = requests.get(url, headers=headers)
+  print(resp.json())
+  resp.raise_for_status()
+
+  if resp.json():
+    print("There's an existing MR already. Exiting!")
+    exit(1)
diff --git a/utils/update_refs.py b/utils/update-refs.py
similarity index 100%
rename from utils/update_refs.py
rename to utils/update-refs.py


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