From 93af659327f3e86b17f9e3837765bb99b151cf7b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20KUBLER?= <gregoire.kubler@proton.me>
Date: Thu, 21 Mar 2024 16:04:09 +0100
Subject: [PATCH] feat : updated condition to check if branch exist also
 including hrouis repo

---
 .gitlab/ci/build.gitlab-ci.yml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/.gitlab/ci/build.gitlab-ci.yml b/.gitlab/ci/build.gitlab-ci.yml
index 52a1e90e..e4fb1d50 100644
--- a/.gitlab/ci/build.gitlab-ci.yml
+++ b/.gitlab/ci/build.gitlab-ci.yml
@@ -25,9 +25,14 @@ build:ubuntu_cpp:
               echo "Pull from ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}"
               BRANCH_TO_PULL=${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}
           fi
-      elif [ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 404 ]; then
+      # checking if given branch exist on official repo or on fork
+      elif [[ $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/aidge/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 404 || \
+              $(curl -s -o /dev/null -w "%{http_code}" "https://gitlab.eclipse.org/eclipse/hrouis/$DEPENDENCY_NAME/-/tree/$CI_COMMIT_REF_NAME") -ne 404 ]] 
+      then
           # Pulling from branch with same name
           BRANCH_TO_PULL=$CI_COMMIT_REF_NAME
+      else
+        echo "No branch \"$CI_COMMIT_REF_NAME\" found for repository \"$DEPENDENCY_NAME\""
       fi
     - echo "Pulling from branch:\"$BRANCH_TO_PULL\""
 
-- 
GitLab