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




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

    test

 .gitlab-ci.yml                           |  7 +++++++
 utils/check-updates.py                   | 17 +++++++++++++++++
 utils/{update_refs.py => update-refs.py} |  0
 3 files changed, 24 insertions(+)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index a990202c4..df9eccebe 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -531,6 +531,13 @@ test-pinephone-pro-aarch64:
   - aarch64
   - gnome-build-meta
 
+update_refs:
+  stage: 'track'
+  script:
+    - python3 utils/check-updates.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-updates.py b/utils/check-updates.py
new file mode 100644
index 000000000..25b187dc3
--- /dev/null
+++ b/utils/check-updates.py
@@ -0,0 +1,17 @@
+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]