@@ -58,9 +58,9 @@ class DataUtils
5858 /**
5959 * Gets the TSV representation from sheets and converts it to YAML on file
6060 *
61- * @return void
61+ * @return bool True if update is successful
6262 */
63- public static function updateData (): void
63+ public static function updateData (): bool
6464 {
6565 $ client = new Client ();
6666 $ promises = [];
@@ -74,9 +74,11 @@ public static function updateData(): void
7474
7575 Promise \Utils::unwrap ($ promises );
7676
77- DataUtils::convertYamlToOrm ();
77+ $ ret = DataUtils::convertYamlToOrm ();
7878 // Clear the cache at the end of all data operations
7979 \file_put_contents ('.clear-cache ' , '' );
80+
81+ return $ ret ;
8082 }
8183
8284 private static function doUpdateData (string $ name , Response $ response ): void
@@ -115,8 +117,9 @@ private static function doUpdateData(string $name, Response $response): void
115117 \file_put_contents ($ outFile , $ yaml );
116118 }
117119
118- private static function convertYamlToOrm (): void
120+ private static function convertYamlToOrm (): bool
119121 {
122+ $ ret = true ;
120123 foreach (self ::OBJECT_NAMES as $ name => $ object ) {
121124 $ failures = array ();
122125
@@ -174,8 +177,12 @@ private static function convertYamlToOrm(): void
174177 $ failures = array_merge ($ failures , $ newFailures );
175178 // If there are no new failure, we will get an infinite loop
176179 } while (count ($ newFailures ));
180+ if (count ($ failures )) {
181+ $ ret = false ;
182+ }
177183 }
184+ return $ ret ;
178185 }
179186}
180187
181- DataUtils::updateData ();
188+ exit ( DataUtils::updateData () ? 0 : 1 );
0 commit comments