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




commit a656f9b1a1c6bcc4fbaeb0f4cae8150b83e1c550
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} |  3 +++
 3 files changed, 32 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a990202c4..088463be0 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 
origin HEAD
+
 
 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 95%
rename from utils/update_refs.py
rename to utils/update-refs.py
index 1e5f02f51..e0aa99904 100755
--- a/utils/update_refs.py
+++ b/utils/update-refs.py
@@ -41,3 +41,6 @@ git(
 git("add", "--update", ".")
 
 git("commit", "--message", "Update element refs")
+
+# FIXME: remove this``
+git("show")


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