From 42a330fadc82a0edc57b21650db2f0c7cec32533 Mon Sep 17 00:00:00 2001
From: laurentheirendt <laurent.heirendt@uni.lu>
Date: Mon, 19 Sep 2022 11:29:55 +0200
Subject: [PATCH] check if yml file from qms exists

---
 .ci/generateIndex.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/.ci/generateIndex.py b/.ci/generateIndex.py
index cf13f017..c0ebeb76 100644
--- a/.ci/generateIndex.py
+++ b/.ci/generateIndex.py
@@ -1,5 +1,6 @@
 import os, re
 from os import path
+from os.path import exists
 from natsort import natsorted
 from pathlib import Path
 import yaml
@@ -341,8 +342,11 @@ for folder in cardDirs:
 
                                 # extract the title from the QMS metadata
                                 if "qms" in root:
-                                    title = save_tag(localroot, root, file[:-3] + ".yml", "title")
-                                    prepare_qms(localroot, root, file)
+                                    if exists(os.path.join(root, file[:-3] + ".yml")):
+                                        title = save_tag(localroot, root, file[:-3] + ".yml", "title")
+                                        prepare_qms(localroot, root, file)
+                                    else:
+                                        print("QMS document is not formatted properly.")
 
                                 # remove the previous header
                                 n = remove_header(localroot, root, file)
-- 
GitLab