From 222ccbeeee350bba0b03f63b386ee36890390e1e Mon Sep 17 00:00:00 2001
From: Timm Fitschen <t.fitschen@indiscale.com>
Date: Thu, 16 Sep 2021 15:24:28 +0200
Subject: [PATCH] WIP: pipeline

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

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1282a72..15fbbfd 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -27,6 +27,7 @@ variables:
   CPPLIB_BRANCH: f-cpp-to-string
 
   OCTAVEINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/121/trigger/pipeline
+  OCTAVEINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/121/repository/branches
 
 
 image: $OCTAVE_REGISTRY_IMAGE
@@ -104,7 +105,11 @@ trigger_inttest:
     ## Determine the octaveinttest branch...
     # ... sync'ed f-branch (f-bar on octavelib requires f-bar on octaveinttest)...
     - if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
-        OCTAVEINT_REF=$CI_COMMIT_REF_NAME ;
+        if curl -o /dev/null -s -w "%{http_code}" $OCTAVEINTTEST_BRANCHES/$CI_COMMIT_REF_NAME | grep "404"; then
+          OCTAVEINT_REF=dev ;
+        else
+          OCTAVEINT_REF=$CI_COMMIT_REF_NAME ;
+        fi
       fi;
     # ... or use main if possible...
     - if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
-- 
GitLab