From 605cf865bb865e9b4bc6b7a3ee0751023f6a2ec4 Mon Sep 17 00:00:00 2001
From: Miguel Angel Reina Ortega <miguelangel.reinaortega@etsi.org>
Date: Wed, 28 Feb 2024 14:53:18 +0100
Subject: [PATCH] Changing rules to execute pipeline only during creation (not
 update) of merge request

---
 generateChangemarks/.gitlab-ci.yml | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/generateChangemarks/.gitlab-ci.yml b/generateChangemarks/.gitlab-ci.yml
index 399d9e2..ed7e1f1 100644
--- a/generateChangemarks/.gitlab-ci.yml
+++ b/generateChangemarks/.gitlab-ci.yml
@@ -6,12 +6,20 @@
 
 workflow:
   rules:
-    - if: $CI_PIPELINE_SOURCE == "merge_request_event" # Creation of Merge Request (generation of CR)
-    - if: $CI_COMMIT_TAG # Creation of tag (publish spec)
-    - if: $CI_PIPELINE_SOURCE == "web" # Removal of a specific entry
+    # Creation of Merge Request (generation of CR). Option 2) compare MR title $CI_MERGE_REQUEST_NAME =~ /^\w{3}(\-\d{4}){2}\-.*/
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event" #&& $CI_MERGE_REQUEST_TITLE =~ /^\w{3}(\-\d{4}){2}\-.*/
+    # Update of Merge Request
+    #- if: $CI_PIPELINE_SOURCE == "merge_request_event" # && $CI_COMMIT_BRANCH != ""
+    #  when: never
+    # Creation of tag (publish spec)
+    - if: $CI_COMMIT_TAG
+    # Removal of a specific entry
+    - if: $CI_PIPELINE_SOURCE == "web"
+    # Pipeline to be run manually as defined in the contribution procedure as it is not known when the CR is ready
     - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
-      when: never # Pipeline to be run manually as defined in the contribution procedure as it is not known when the CR is ready
-    - if: $CI_PIPELINE_SOURCE == "trigger" # Upgrade of the index.html page
+      when: never
+    # Upgrade of the index.html page
+    - if: $CI_PIPELINE_SOURCE == "trigger"
 
 variables:
 
@@ -38,6 +46,7 @@ Word CR:
      curl "${CI_API_V4_URL}/projects/$TOOLS_SCRIPTS_PROJECT_ID/repository/files/Spec-template%2Edocx/raw?ref=master" >> onem2m_spec_template.docx
   script:
     - echo 'CR contribution'
+    - env
     - mkdir docs
     - ./generate_changemarks.sh ${CI_PROJECT_URL} ${CI_MERGE_REQUEST_PROJECT_ID} ${CI_MERGE_REQUEST_IID} onem2m_delimiter_start.docx onem2m_delimiter_end.docx onem2m_coversheet_template.docx onem2m_spec_template.docx
   artifacts:
-- 
GitLab